1
0

qml: disable Qt Virtual Keyboard and refactor keyboardFreeZone item to take

android system keyboard into account
This commit is contained in:
Sander van Grieken
2023-05-01 18:39:16 +02:00
parent 9ac83f6d9f
commit 6394cdcd3b
2 changed files with 31 additions and 27 deletions

View File

@@ -61,10 +61,6 @@ class ElectrumGui(BaseElectrumGui, Logger):
# os.environ['QML_IMPORT_TRACE'] = '1' # os.environ['QML_IMPORT_TRACE'] = '1'
# os.environ['QT_DEBUG_PLUGINS'] = '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' os.environ['QT_ANDROID_DISABLE_ACCESSIBILITY'] = '1'
# set default locale to en_GB. This is for l10n (e.g. number formatting, number input etc), # set default locale to en_GB. This is for l10n (e.g. number formatting, number input etc),

View File

@@ -3,6 +3,7 @@ import QtQuick.Layouts 1.0
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import QtQuick.Controls.Material.impl 2.12 import QtQuick.Controls.Material.impl 2.12
import QtQuick.Window 2.15
import QtQml 2.6 import QtQml 2.6
import QtMultimedia 5.6 import QtMultimedia 5.6
@@ -31,7 +32,6 @@ ApplicationWindow
Constants { id: appconstants } Constants { id: appconstants }
property alias stack: mainStackView property alias stack: mainStackView
property alias inputPanel: inputPanel
property variant activeDialogs: [] property variant activeDialogs: []
@@ -224,7 +224,7 @@ ApplicationWindow
StackView { StackView {
id: mainStackView id: mainStackView
width: parent.width width: parent.width
height: inputPanel.y - header.height height: keyboardFreeZone.height - header.height
initialItem: Qt.resolvedUrl('WalletMainView.qml') initialItem: Qt.resolvedUrl('WalletMainView.qml')
function getRoot() { function getRoot() {
@@ -266,39 +266,47 @@ ApplicationWindow
} }
Item { Item {
id: keyboardFreeZone
// Item as first child in Overlay that adjusts its size to the available // 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) // screen space minus the virtual keyboard (e.g. to center dialogs in)
// see ElDialog.resizeWithKeyboard property // see also ElDialog.resizeWithKeyboard property
parent: Overlay.overlay parent: Overlay.overlay
width: parent.width width: parent.width
height: inputPanel.y height: parent.height
}
InputPanel {
id: inputPanel
width: parent.width
y: parent.height
states: State { states: State {
name: "visible" name: "visible"
when: inputPanel.active when: Qt.inputMethod.visible
PropertyChanges { PropertyChanges {
target: inputPanel target: keyboardFreeZone
y: parent.height - height height: keyboardFreeZone.parent.height - Qt.inputMethod.keyboardRectangle.height / Screen.devicePixelRatio
} }
} }
transitions: Transition { transitions: [
from: '' Transition {
to: 'visible' from: ''
reversible: true to: 'visible'
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
properties: "y" properties: "height"
duration: 250 duration: 250
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
}
}
},
Transition {
from: 'visible'
to: ''
ParallelAnimation {
NumberAnimation {
properties: "height"
duration: 50
easing.type: Easing.OutQuad
}
} }
} }
} ]
} }
property alias newWalletWizard: _newWalletWizard property alias newWalletWizard: _newWalletWizard