qml: add SeedKeyboard for seed entry without using system virtual keyboard

This commit is contained in:
Sander van Grieken
2023-05-01 16:59:40 +02:00
parent 5600375d51
commit 9ac83f6d9f
3 changed files with 141 additions and 1 deletions
@@ -11,7 +11,7 @@ Pane {
padding: 0
property string text
property alias readOnly: seedtextarea.readOnly
property bool readOnly: false
property alias placeholderText: seedtextarea.placeholderText
property var _suggestions: []
@@ -83,6 +83,7 @@ Pane {
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhLowercaseOnly | Qt.ImhNoPredictiveText
readOnly: true
background: Rectangle {
color: constants.darkerBackground
@@ -100,6 +101,21 @@ Pane {
cursorPosition = text.length
}
}
SeedKeyboard {
id: kbd
Layout.fillWidth: true
Layout.preferredHeight: kbd.width / 2
visible: !root.readOnly
onKeyEvent: {
if (keycode == Qt.Key_Backspace) {
if (seedtextarea.text.length > 0)
seedtextarea.text = seedtextarea.text.substring(0, seedtextarea.text.length-1)
} else {
seedtextarea.text = seedtextarea.text + text
}
}
}
}
FontMetrics {