aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2024-02-02 15:47:14 -0700
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-02-07 15:56:51 +0000
commitbf32e329d14ddcfa03c84367971b0751c9601738 (patch)
treed021f6d8b38f2897832f27240743042cdfef16c3
parent1c4de2f434cc89e1bb2dae7955eee689267e5a94 (diff)
texteditor example: use TextDocument status rather than error signal
Amends 5647b6900b2ecc291022143176b545b933eca3a8 in which the error signal was removed and replaced with a status property. Change-Id: I433987fe4c480c910c98c8fd3714c2e426e49c0f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit bec8df96b7615c6ce419867254027773ea7fd6b1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/quickcontrols/texteditor/qml/texteditor.qml22
1 files changed, 19 insertions, 3 deletions
diff --git a/examples/quickcontrols/texteditor/qml/texteditor.qml b/examples/quickcontrols/texteditor/qml/texteditor.qml
index 9c0747937b..e48b967ffe 100644
--- a/examples/quickcontrols/texteditor/qml/texteditor.qml
+++ b/examples/quickcontrols/texteditor/qml/texteditor.qml
@@ -496,9 +496,25 @@ ApplicationWindow {
textDocument.source = "qrc:/texteditor.html";
}
- textDocument.onError: function (message) {
- errorDialog.text = message
- errorDialog.open()
+ textDocument.onStatusChanged: {
+ var err = ""
+ switch (textDocument.status) {
+ case TextDocument.ReadError:
+ err = qsTr("Failed to load ") + textDocument.source
+ break
+ case TextDocument.WriteError:
+ err = qsTr("Failed to save ") + textDocument.source
+ break
+ case TextDocument.NonLocalFileError:
+ err = qsTr("Not a local file: ") + textDocument.source
+ break
+ default:
+ break
+ }
+ if (err !== "") {
+ errorDialog.text = err
+ errorDialog.open()
+ }
}
}