Close dialogs when escape pressed

TextFields needs to do this explicitly
This commit is contained in:
Dag Heyman 2017-03-17 15:47:24 +01:00
parent 8478bd7539
commit ffd207b064
No known key found for this signature in database
GPG Key ID: 06FC004369E7D338
4 changed files with 13 additions and 0 deletions

View File

@ -28,6 +28,7 @@ DefaultDialog {
TextField {
id: name
Layout.fillWidth: true
Keys.onEscapePressed: close()
}
Label {
@ -39,6 +40,7 @@ DefaultDialog {
validator: RegExpValidator {
regExp: /[2-7a-zA-Z]+=*/
}
Keys.onEscapePressed: close()
}
}

View File

@ -31,6 +31,7 @@ DefaultDialog {
validator: RegExpValidator {
regExp: /[2-7a-zA-Z]+=*/
}
Keys.onEscapePressed: close()
}
}

View File

@ -5,6 +5,9 @@ import QtQuick.Window 2.2
ApplicationWindow {
SystemPalette {
id: palette
}
@ -37,8 +40,13 @@ ApplicationWindow {
Item {
id: destruction_parent
}
Item {
focus: true
Keys.onEscapePressed: close()
}
}
function open() {
show()
}

View File

@ -25,6 +25,7 @@ DefaultDialog {
id: newPassword
echoMode: TextInput.Password
Layout.fillWidth: true
Keys.onEscapePressed: close()
}
Label {
text: qsTr("Confirm password: ")
@ -34,6 +35,7 @@ DefaultDialog {
echoMode: TextInput.Password
Layout.fillWidth: true
onAccepted: promptAccepted()
Keys.onEscapePressed: close()
}
}
RowLayout {