Browse Source

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

android system keyboard into account
master
Sander van Grieken 3 years ago
parent
commit
6394cdcd3b
  1. 4
      electrum/gui/qml/__init__.py
  2. 54
      electrum/gui/qml/components/main.qml

4
electrum/gui/qml/__init__.py

@ -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),

54
electrum/gui/qml/components/main.qml

@ -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

Loading…
Cancel
Save