Browse Source

qml: add deadzones on the edge of the screen to work around android back gesture unintended click events

master
Sander van Grieken 2 years ago committed by accumulator
parent
commit
583afefe33
  1. 2
      electrum/gui/qml/components/Addresses.qml
  2. 2
      electrum/gui/qml/components/Channels.qml
  3. 14
      electrum/gui/qml/components/History.qml
  4. 2
      electrum/gui/qml/components/Invoices.qml
  5. 10
      electrum/gui/qml/components/Preferences.qml
  6. 2
      electrum/gui/qml/components/ReceiveRequests.qml
  7. 2
      electrum/gui/qml/components/Wallets.qml
  8. 38
      electrum/gui/qml/components/controls/ElListView.qml
  9. 2
      electrum/gui/qml/components/controls/ServerConfig.qml

2
electrum/gui/qml/components/Addresses.qml

@ -17,7 +17,7 @@ Pane {
id: layout
anchors.fill: parent
ListView {
ElListView {
id: listview
Layout.fillWidth: true

2
electrum/gui/qml/components/Channels.qml

@ -75,7 +75,7 @@ Pane {
spacing: 0
anchors.fill: parent
ListView {
ElListView {
id: listview
Layout.preferredWidth: parent.width
Layout.fillHeight: true

14
electrum/gui/qml/components/History.qml

@ -18,7 +18,7 @@ Pane {
color: constants.darkerBackground
}
ListView {
ElListView {
id: listview
width: parent.width
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 {
id: dragb
anchors.right: vdragscroll.left

2
electrum/gui/qml/components/Invoices.qml

@ -39,7 +39,7 @@ Pane {
Layout.fillHeight: true
Layout.fillWidth: true
ListView {
ElListView {
id: listview
anchors.fill: parent
clip: true

10
electrum/gui/qml/components/Preferences.qml

@ -79,7 +79,6 @@ Pane {
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: thousands
@ -96,7 +95,6 @@ Pane {
}
RowLayout {
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: fiatEnable
@ -125,7 +123,6 @@ Pane {
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: historicRates
@ -162,7 +159,6 @@ Pane {
RowLayout {
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: usePin
@ -220,7 +216,6 @@ Pane {
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: syncLabels
@ -243,7 +238,6 @@ Pane {
RowLayout {
Layout.columnSpan: 2
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: spendUnconfirmed
@ -267,7 +261,6 @@ Pane {
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: useTrampolineRouting
@ -303,7 +296,6 @@ Pane {
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: useRecoverableChannels
@ -338,7 +330,6 @@ Pane {
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: useFallbackAddress
@ -362,7 +353,6 @@ Pane {
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: -constants.paddingSmall
spacing: 0
Switch {
id: enableDebugLogs

2
electrum/gui/qml/components/ReceiveRequests.qml

@ -42,7 +42,7 @@ Pane {
Layout.fillHeight: true
Layout.fillWidth: true
ListView {
ElListView {
id: listview
anchors.fill: parent
clip: true

2
electrum/gui/qml/components/Wallets.qml

@ -47,7 +47,7 @@ Pane {
horizontalPadding: 0
background: PaneInsetBackground {}
ListView {
ElListView {
id: listview
anchors.fill: parent
clip: true

38
electrum/gui/qml/components/controls/ElListView.qml

@ -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()
}
}

2
electrum/gui/qml/components/controls/ServerConfig.qml

@ -57,7 +57,7 @@ Item {
Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge
ListView {
ElListView {
id: serversListView
anchors.fill: parent
model: Network.serverListModel

Loading…
Cancel
Save