diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-10-10 15:04:10 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-10-20 06:30:33 +0200 |
commit | 064a782a54ab1ad8f28a049ddf55db7376edf357 (patch) | |
tree | 541febcf8e4280a082086a081a8e6cfcd15e9059 /examples | |
parent | e63548e7dbe065286d07b8bd06e7e8eea4399e73 (diff) | |
download | qtquickcontrols-064a782a54ab1ad8f28a049ddf55db7376edf357.tar.gz |
Dialog examples: handle keys for accept, and more feedback
All dialogs populate the label showing how they were accepted or
rejected.
Change-Id: I0bad4af0864bdf24e56c18aeecd8ca8f6536b6b0
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quick/dialogs/systemdialogs/CustomDialogs.qml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/quick/dialogs/systemdialogs/CustomDialogs.qml b/examples/quick/dialogs/systemdialogs/CustomDialogs.qml index cc91fbb4..d1143775 100644 --- a/examples/quick/dialogs/systemdialogs/CustomDialogs.qml +++ b/examples/quick/dialogs/systemdialogs/CustomDialogs.qml @@ -123,6 +123,7 @@ Item { else lastChosen.text = (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)") } + onRejected: lastChosen.text = "Rejected" Calendar { id: calendar @@ -136,6 +137,9 @@ Item { modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal title: customizeTitle.checked ? windowTitleField.text : "Customized content" onRejected: lastChosen.text = "Rejected" + onAccepted: lastChosen.text = "Accepted " + + (clickedButton === StandardButton.Retry ? "(Retry)" : "(OK)") + onButtonClicked: if (clickedButton === StandardButton.Retry) lastChosen.text = "Retry" contentItem: Rectangle { color: "lightskyblue" implicitWidth: 400 @@ -145,6 +149,8 @@ Item { color: "navy" anchors.centerIn: parent } + Keys.onPressed: if (event.key === Qt.Key_R && (event.modifiers & Qt.ControlModifier)) filledDialog.click(StandardButton.Retry) + Keys.onEnterPressed: filledDialog.accept() Keys.onEscapePressed: filledDialog.reject() Keys.onBackPressed: filledDialog.reject() // especially necessary on Android } |