1
0

qml: create workaround for spurious textChanged events coming from TextArea. fixes #8280

This commit also fixes a gap, where a seed text change could leave the page valid for the
duration of the valid check delay timer, while the seed is actually invalid.
This commit is contained in:
Sander van Grieken
2023-03-25 12:58:22 +01:00
parent 965e1ac9a3
commit 78d79290ad

View File

@@ -10,12 +10,17 @@ Pane {
implicitHeight: rootLayout.height
padding: 0
property string text
property alias readOnly: seedtextarea.readOnly
property alias text: seedtextarea.text
property alias placeholderText: seedtextarea.placeholderText
property var _suggestions: []
onTextChanged: {
if (seedtextarea.text != text)
seedtextarea.text = text
}
background: Rectangle {
color: "transparent"
}
@@ -84,6 +89,12 @@ Pane {
}
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