mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
qml: Clear saved password using onPressed handler
Using onTextEdited meant that the clear() call would happen after the edit had actually happened. Instead, use the Keys.onPressed handler, which happens earlier in the input chain.
This commit is contained in:
parent
d19c7599f7
commit
9b15f7909b
1 changed files with 9 additions and 2 deletions
|
@ -153,19 +153,26 @@ Window {
|
|||
}
|
||||
TextField {
|
||||
id: fieldUserPassword
|
||||
echoMode: TextInput.Password
|
||||
echoMode: TextInput.PasswordEchoOnEdit
|
||||
Layout.minimumWidth: 200
|
||||
selectByMouse: true
|
||||
property bool alreadyCrypted: false
|
||||
property bool indicateError: false
|
||||
|
||||
onTextEdited: {
|
||||
Keys.onPressed: (event)=> {
|
||||
if (alreadyCrypted) {
|
||||
/* User is trying to edit saved
|
||||
(crypted) password, clear field */
|
||||
alreadyCrypted = false
|
||||
clear()
|
||||
}
|
||||
|
||||
// Do not mark the event as accepted, so that it may
|
||||
// propagate down to the underlying TextField.
|
||||
event.accepted = false
|
||||
}
|
||||
|
||||
onTextEdited: {
|
||||
if (indicateError) {
|
||||
indicateError = false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue