diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-06 13:31:44 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-06 13:31:45 +0200 |
commit | 3703d57161dc4ad7df000403bfcc43ac78eb6617 (patch) | |
tree | 4ab8ca921336f38ca539b699c6f4c0d7dc3de949 /examples/quickcontrols2/texteditor/qml/texteditor.qml | |
parent | 94fdd09199b3373bc6d6e9d9c873cd16d54184a5 (diff) | |
parent | 567a5cf69ef39ba5e9d0558ee7d6caec4d69bf71 (diff) |
Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: Ie9314e1a5daa20cee9d95a3c42873dbe515b3333
Diffstat (limited to 'examples/quickcontrols2/texteditor/qml/texteditor.qml')
-rw-r--r-- | examples/quickcontrols2/texteditor/qml/texteditor.qml | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/examples/quickcontrols2/texteditor/qml/texteditor.qml b/examples/quickcontrols2/texteditor/qml/texteditor.qml index a1cb3435..6c95335b 100644 --- a/examples/quickcontrols2/texteditor/qml/texteditor.qml +++ b/examples/quickcontrols2/texteditor/qml/texteditor.qml @@ -80,7 +80,7 @@ ApplicationWindow { } Shortcut { sequence: StandardKey.Quit - onActivated: Qt.quit() + onActivated: close() } Shortcut { sequence: StandardKey.Copy @@ -121,7 +121,7 @@ ApplicationWindow { } MenuItem { text: qsTr("&Quit") - onTriggered: Qt.quit() + onTriggered: close() } } @@ -205,6 +205,14 @@ ApplicationWindow { id: errorDialog } + MessageDialog { + id : quitDialog + title: qsTr("Quit?") + text: qsTr("The file has been modified. Quit anyway?") + buttons: (MessageDialog.Yes | MessageDialog.No) + onYesClicked: Qt.quit() + } + header: ToolBar { leftPadding: 8 @@ -449,4 +457,11 @@ ApplicationWindow { onTriggered: colorDialog.open() } } + + onClosing: { + if (document.modified) { + quitDialog.open() + close.accepted = false + } + } } |