diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-15 13:51:20 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-15 13:55:22 +0200 |
commit | 6f617349cf865ca3a7befc0dd472b7c2510fc431 (patch) | |
tree | 37e70da54a7f3101b82551ccd98508f8d9d64330 /examples/quickcontrols2/texteditor/qml/texteditor.qml | |
parent | 718e08392f34dc478ea010c08a4b9c77bb665dfc (diff) | |
parent | 8e2d1b1efe736760d27af17160f662454546b054 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Removed dependencies.yaml.
Change-Id: I1e2b3f486e9ace4bc8dc0419a64848990b3a6b39
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 + } + } } |