From db532dbd1973bf2d37badeeba2674fd254f1250f Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Tue, 3 Oct 2023 18:53:00 +0200 Subject: [PATCH] qml: android back-gesture conflict hack not working on qt6, replace with simple properties --- .../qml/components/controls/ElListView.qml | 39 +++++++------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/electrum/gui/qml/components/controls/ElListView.qml b/electrum/gui/qml/components/controls/ElListView.qml index 60111b50e..dc31b6094 100644 --- a/electrum/gui/qml/components/controls/ElListView.qml +++ b/electrum/gui/qml/components/controls/ElListView.qml @@ -1,40 +1,27 @@ -import QtQuick 2.6 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Material 2.0 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtQuick.Controls.Material ListView { id: root - property int width_left_exclusion_zone: 0 - property int width_right_exclusion_zone: 0 + // avoid interference with android back-gesture by defining deadzones + // you can override to 0 if listview is away from left or right edge. + property int exclusionZone: constants.fingerWidth / 2 + property int leftExclusionZone: exclusionZone + property int rightExclusionZone: exclusionZone MouseArea { anchors {top: root.top; left: root.left; bottom: root.bottom } - visible: width_left_exclusion_zone > 0 - width: width_left_exclusion_zone + visible: leftExclusionZone > 0 + width: leftExclusionZone } MouseArea { anchors { top: root.top; right: root.right; bottom: root.bottom } - visible: width_right_exclusion_zone > 0 - width: width_right_exclusion_zone + visible: rightExclusionZone > 0 + width: rightExclusionZone } - // 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) // note: coords on whole *screen*, not just window - 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: { - if (AppController.isAndroid()) { - layoutExclusionZones() - } - } }