diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-05-09 23:16:05 +0200 |
---|---|---|
committer | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-05-11 12:56:22 +0200 |
commit | 5b0bb8d78e1854f3a23d7dd0bb286f524b272c37 (patch) | |
tree | c83fa6ab4fd78d3b88a3ab9fa1a7e47b24ac6e4a | |
parent | df36473e943f0a53df640f61737abea7f5776c20 (diff) |
Update the text editor to use the MessageDialog in qt quick dialogs
Our goal is to eventually remove the dependency for the qt labs platform
module. This patch will replace one of the labs platform MessageDialogs,
with a MessageDialog from qt quick dialogs.
All of the dialogs that are used in this example will eventually be from
the qt quick dialogs module.
Change-Id: I19f97948bf04d0fa5b265e057bbf49374bb51472
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | examples/quickcontrols2/texteditor/qml/texteditor.qml | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/quickcontrols2/texteditor/qml/texteditor.qml b/examples/quickcontrols2/texteditor/qml/texteditor.qml index 5f47223bd3..19245b106b 100644 --- a/examples/quickcontrols2/texteditor/qml/texteditor.qml +++ b/examples/quickcontrols2/texteditor/qml/texteditor.qml @@ -210,7 +210,7 @@ ApplicationWindow { nameFilters: openDialog.nameFilters selectedNameFilter.index: document.fileType === "txt" ? 0 : 1 currentFolder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) - onAccepted: document.saveAs(file) + onAccepted: document.saveAs(selectedFile) } FontDialog { @@ -225,16 +225,17 @@ ApplicationWindow { currentColor: "black" } - Platform.MessageDialog { + MessageDialog { + title: qsTr("Error") id: errorDialog } - Platform.MessageDialog { + MessageDialog { id : quitDialog title: qsTr("Quit?") text: qsTr("The file has been modified. Quit anyway?") - buttons: (Platform.MessageDialog.Yes | Platform.MessageDialog.No) - onYesClicked: Qt.quit() + buttons: MessageDialog.Yes | MessageDialog.No + onButtonClicked: function (button, role) { if (role === MessageDialog.YesRole) Qt.quit() } } header: ToolBar { @@ -435,7 +436,7 @@ ApplicationWindow { } onError: function (message) { errorDialog.text = message - errorDialog.visible = true + errorDialog.open() } } |