From 6394cdcd3b25885d8bf0e31331b45f8dd4e1529b Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 1 May 2023 18:39:16 +0200 Subject: [PATCH] qml: disable Qt Virtual Keyboard and refactor keyboardFreeZone item to take android system keyboard into account --- electrum/gui/qml/__init__.py | 4 --- electrum/gui/qml/components/main.qml | 54 ++++++++++++++++------------ 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/electrum/gui/qml/__init__.py b/electrum/gui/qml/__init__.py index 6a0a70037..5d5bf5045 100644 --- a/electrum/gui/qml/__init__.py +++ b/electrum/gui/qml/__init__.py @@ -61,10 +61,6 @@ class ElectrumGui(BaseElectrumGui, Logger): # os.environ['QML_IMPORT_TRACE'] = '1' # os.environ['QT_DEBUG_PLUGINS'] = '1' - os.environ['QT_IM_MODULE'] = 'qtvirtualkeyboard' - os.environ['QT_VIRTUALKEYBOARD_STYLE'] = 'Electrum' - os.environ['QML2_IMPORT_PATH'] = 'electrum/gui/qml' - os.environ['QT_ANDROID_DISABLE_ACCESSIBILITY'] = '1' # set default locale to en_GB. This is for l10n (e.g. number formatting, number input etc), diff --git a/electrum/gui/qml/components/main.qml b/electrum/gui/qml/components/main.qml index e6b770ad9..1dd04544a 100644 --- a/electrum/gui/qml/components/main.qml +++ b/electrum/gui/qml/components/main.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts 1.0 import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material.impl 2.12 +import QtQuick.Window 2.15 import QtQml 2.6 import QtMultimedia 5.6 @@ -31,7 +32,6 @@ ApplicationWindow Constants { id: appconstants } property alias stack: mainStackView - property alias inputPanel: inputPanel property variant activeDialogs: [] @@ -224,7 +224,7 @@ ApplicationWindow StackView { id: mainStackView width: parent.width - height: inputPanel.y - header.height + height: keyboardFreeZone.height - header.height initialItem: Qt.resolvedUrl('WalletMainView.qml') function getRoot() { @@ -266,39 +266,47 @@ ApplicationWindow } Item { + id: keyboardFreeZone // Item as first child in Overlay that adjusts its size to the available // screen space minus the virtual keyboard (e.g. to center dialogs in) - // see ElDialog.resizeWithKeyboard property + // see also ElDialog.resizeWithKeyboard property parent: Overlay.overlay width: parent.width - height: inputPanel.y - } - - InputPanel { - id: inputPanel - width: parent.width - y: parent.height + height: parent.height states: State { name: "visible" - when: inputPanel.active + when: Qt.inputMethod.visible PropertyChanges { - target: inputPanel - y: parent.height - height + target: keyboardFreeZone + height: keyboardFreeZone.parent.height - Qt.inputMethod.keyboardRectangle.height / Screen.devicePixelRatio } } - transitions: Transition { - from: '' - to: 'visible' - reversible: true - ParallelAnimation { - NumberAnimation { - properties: "y" - duration: 250 - easing.type: Easing.OutQuad + transitions: [ + Transition { + from: '' + to: 'visible' + ParallelAnimation { + NumberAnimation { + properties: "height" + duration: 250 + easing.type: Easing.OutQuad + } + } + }, + Transition { + from: 'visible' + to: '' + ParallelAnimation { + NumberAnimation { + properties: "height" + duration: 50 + easing.type: Easing.OutQuad + } } } - } + ] + } property alias newWalletWizard: _newWalletWizard