diff --git a/electrum/gui/qml/components/Addresses.qml b/electrum/gui/qml/components/Addresses.qml index 91d7e20be..48ef0cf1b 100644 --- a/electrum/gui/qml/components/Addresses.qml +++ b/electrum/gui/qml/components/Addresses.qml @@ -17,7 +17,7 @@ Pane { id: layout anchors.fill: parent - ListView { + ElListView { id: listview Layout.fillWidth: true diff --git a/electrum/gui/qml/components/Channels.qml b/electrum/gui/qml/components/Channels.qml index dbe3d7888..5609ff324 100644 --- a/electrum/gui/qml/components/Channels.qml +++ b/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 diff --git a/electrum/gui/qml/components/History.qml b/electrum/gui/qml/components/History.qml index 4134d9a1a..c1e9bd73e 100644 --- a/electrum/gui/qml/components/History.qml +++ b/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 diff --git a/electrum/gui/qml/components/Invoices.qml b/electrum/gui/qml/components/Invoices.qml index 473fe8f2b..5403a7baa 100644 --- a/electrum/gui/qml/components/Invoices.qml +++ b/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 diff --git a/electrum/gui/qml/components/Preferences.qml b/electrum/gui/qml/components/Preferences.qml index 5ec5356be..893333e13 100644 --- a/electrum/gui/qml/components/Preferences.qml +++ b/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 diff --git a/electrum/gui/qml/components/ReceiveRequests.qml b/electrum/gui/qml/components/ReceiveRequests.qml index 78f3bd4b3..879e3b928 100644 --- a/electrum/gui/qml/components/ReceiveRequests.qml +++ b/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 diff --git a/electrum/gui/qml/components/Wallets.qml b/electrum/gui/qml/components/Wallets.qml index f651fa33c..7d911a854 100644 --- a/electrum/gui/qml/components/Wallets.qml +++ b/electrum/gui/qml/components/Wallets.qml @@ -47,7 +47,7 @@ Pane { horizontalPadding: 0 background: PaneInsetBackground {} - ListView { + ElListView { id: listview anchors.fill: parent clip: true diff --git a/electrum/gui/qml/components/controls/ElListView.qml b/electrum/gui/qml/components/controls/ElListView.qml new file mode 100644 index 000000000..9ae1c121e --- /dev/null +++ b/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() + } +} diff --git a/electrum/gui/qml/components/controls/ServerConfig.qml b/electrum/gui/qml/components/controls/ServerConfig.qml index 5991a9fdf..a18056869 100644 --- a/electrum/gui/qml/components/controls/ServerConfig.qml +++ b/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