qml: add deadzones on the edge of the screen to work around android back gesture unintended click events
This commit is contained in:
committed by
accumulator
parent
a6a2679d8a
commit
583afefe33
@@ -17,7 +17,7 @@ Pane {
|
|||||||
id: layout
|
id: layout
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
ListView {
|
ElListView {
|
||||||
id: listview
|
id: listview
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ Pane {
|
|||||||
spacing: 0
|
spacing: 0
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
ListView {
|
ElListView {
|
||||||
id: listview
|
id: listview
|
||||||
Layout.preferredWidth: parent.width
|
Layout.preferredWidth: parent.width
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Pane {
|
|||||||
color: constants.darkerBackground
|
color: constants.darkerBackground
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ElListView {
|
||||||
id: listview
|
id: listview
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
@@ -107,18 +107,6 @@ Pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
// cover list items, make left side insensitive to clicks
|
|
||||||
// this helps with the back gesture on newer androids
|
|
||||||
id: left_backgesture_hack
|
|
||||||
anchors {
|
|
||||||
top: listview.top
|
|
||||||
left: listview.left
|
|
||||||
bottom: listview.bottom
|
|
||||||
}
|
|
||||||
width: constants.fingerWidth
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: dragb
|
id: dragb
|
||||||
anchors.right: vdragscroll.left
|
anchors.right: vdragscroll.left
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ Pane {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
ListView {
|
ElListView {
|
||||||
id: listview
|
id: listview
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ Pane {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: thousands
|
id: thousands
|
||||||
@@ -96,7 +95,6 @@ Pane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: fiatEnable
|
id: fiatEnable
|
||||||
@@ -125,7 +123,6 @@ Pane {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: historicRates
|
id: historicRates
|
||||||
@@ -162,7 +159,6 @@ Pane {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: usePin
|
id: usePin
|
||||||
@@ -220,7 +216,6 @@ Pane {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: syncLabels
|
id: syncLabels
|
||||||
@@ -243,7 +238,6 @@ Pane {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: spendUnconfirmed
|
id: spendUnconfirmed
|
||||||
@@ -267,7 +261,6 @@ Pane {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: useTrampolineRouting
|
id: useTrampolineRouting
|
||||||
@@ -303,7 +296,6 @@ Pane {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: useRecoverableChannels
|
id: useRecoverableChannels
|
||||||
@@ -338,7 +330,6 @@ Pane {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: useFallbackAddress
|
id: useFallbackAddress
|
||||||
@@ -362,7 +353,6 @@ Pane {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: -constants.paddingSmall
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Switch {
|
Switch {
|
||||||
id: enableDebugLogs
|
id: enableDebugLogs
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ Pane {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
ListView {
|
ElListView {
|
||||||
id: listview
|
id: listview
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ Pane {
|
|||||||
horizontalPadding: 0
|
horizontalPadding: 0
|
||||||
background: PaneInsetBackground {}
|
background: PaneInsetBackground {}
|
||||||
|
|
||||||
ListView {
|
ElListView {
|
||||||
id: listview
|
id: listview
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
|
|||||||
38
electrum/gui/qml/components/controls/ElListView.qml
Normal file
38
electrum/gui/qml/components/controls/ElListView.qml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import QtQuick 2.6
|
||||||
|
import QtQuick.Layouts 1.0
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
import QtQuick.Controls.Material 2.0
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property int width_left_exclusion_zone: 0
|
||||||
|
property int width_right_exclusion_zone: 0
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors {top: root.top; left: root.left; bottom: root.bottom }
|
||||||
|
visible: width_left_exclusion_zone > 0
|
||||||
|
width: width_left_exclusion_zone
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors { top: root.top; right: root.right; bottom: root.bottom }
|
||||||
|
visible: width_right_exclusion_zone > 0
|
||||||
|
width: width_right_exclusion_zone
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine distance from sides of window and reserve some
|
||||||
|
// space using noop mouseareas in order to not emit clicks when
|
||||||
|
// android back gesture is used
|
||||||
|
function layoutExclusionZones() {
|
||||||
|
var reserve = constants.fingerWidth / 2
|
||||||
|
var p = root.mapToGlobal(0, 0)
|
||||||
|
width_left_exclusion_zone = Math.max(0, reserve - p.x)
|
||||||
|
p = root.mapToGlobal(width, 0)
|
||||||
|
width_right_exclusion_zone = Math.max(0, reserve - (app.width - p.x))
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
layoutExclusionZones()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,7 +57,7 @@ Item {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.bottomMargin: constants.paddingLarge
|
Layout.bottomMargin: constants.paddingLarge
|
||||||
|
|
||||||
ListView {
|
ElListView {
|
||||||
id: serversListView
|
id: serversListView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: Network.serverListModel
|
model: Network.serverListModel
|
||||||
|
|||||||
Reference in New Issue
Block a user