qml: seedtext word suggestions below text area
This commit is contained in:
@@ -29,6 +29,39 @@ Pane {
|
|||||||
id: rootLayout
|
id: rootLayout
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
|
TextArea {
|
||||||
|
id: seedtextarea
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.minimumHeight: fontMetrics.height * 3 + topPadding + bottomPadding
|
||||||
|
|
||||||
|
rightPadding: constants.paddingLarge
|
||||||
|
leftPadding: constants.paddingLarge
|
||||||
|
|
||||||
|
wrapMode: TextInput.WordWrap
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: constants.fontSizeLarge
|
||||||
|
font.family: FixedFont
|
||||||
|
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhLowercaseOnly | Qt.ImhNoPredictiveText
|
||||||
|
readOnly: true
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: constants.darkerBackground
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
// work around Qt issue, TextArea fires spurious textChanged events
|
||||||
|
// NOTE: might be Qt virtual keyboard, or Qt upgrade from 5.15.2 to 5.15.7
|
||||||
|
if (root.text != text)
|
||||||
|
root.text = text
|
||||||
|
|
||||||
|
// update suggestions
|
||||||
|
_suggestions = bitcoin.mnemonicsFor(seedtextarea.text.split(' ').pop())
|
||||||
|
// TODO: cursorPosition only on suggestion apply
|
||||||
|
cursorPosition = text.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
Layout.preferredWidth: parent.width
|
Layout.preferredWidth: parent.width
|
||||||
Layout.minimumHeight: fontMetrics.lineSpacing + 2*constants.paddingXXSmall + 2*constants.paddingXSmall + 2
|
Layout.minimumHeight: fontMetrics.lineSpacing + 2*constants.paddingXXSmall + 2*constants.paddingXSmall + 2
|
||||||
@@ -70,38 +103,6 @@ Pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextArea {
|
|
||||||
id: seedtextarea
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.minimumHeight: fontMetrics.height * 3 + topPadding + bottomPadding
|
|
||||||
|
|
||||||
rightPadding: constants.paddingLarge
|
|
||||||
leftPadding: constants.paddingLarge
|
|
||||||
|
|
||||||
wrapMode: TextInput.WordWrap
|
|
||||||
font.bold: true
|
|
||||||
font.pixelSize: constants.fontSizeLarge
|
|
||||||
font.family: FixedFont
|
|
||||||
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhLowercaseOnly | Qt.ImhNoPredictiveText
|
|
||||||
readOnly: true
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
color: constants.darkerBackground
|
|
||||||
}
|
|
||||||
|
|
||||||
onTextChanged: {
|
|
||||||
// work around Qt issue, TextArea fires spurious textChanged events
|
|
||||||
// NOTE: might be Qt virtual keyboard, or Qt upgrade from 5.15.2 to 5.15.7
|
|
||||||
if (root.text != text)
|
|
||||||
root.text = text
|
|
||||||
|
|
||||||
// update suggestions
|
|
||||||
_suggestions = bitcoin.mnemonicsFor(seedtextarea.text.split(' ').pop())
|
|
||||||
// TODO: cursorPosition only on suggestion apply
|
|
||||||
cursorPosition = text.length
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SeedKeyboard {
|
SeedKeyboard {
|
||||||
id: kbd
|
id: kbd
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|||||||
Reference in New Issue
Block a user