Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.7.0 Beta1, 6.8
-
None
-
1e6cb2462 (dev), 460f8e4c3 (6.7), 5cba3f5a8 (dev), 21dfc2508 (6.7)
Description
I think this ought to be possible:
TextArea { textDocument.onStatusChanged: { const statusMessages = { TextDocument.ReadError: "Failed to load ", TextDocument.WriteError: "Failed to save ", TextDocument.NonLocalFileError: "Not a local file: ", } const err = statusMessages[textDocument.status] if (err) { errorDialog.text = err errorDialog.open() } }
I'd go even further and put the string table into a property rather than needing to re-construct this const object each time the statusChanged callback occurs. (So what type should the property be then?) But either way, there is an error; in this case it says
texteditor.qml:500:33: Expected token `,'
I guess it doesn't expect a dot operator to occur in the key definition; whereas using a plain hard-coded number as a key is fine.
https://codereview.qt-project.org/c/qt/qtdeclarative/+/537373 tries to modify the texteditor example in this way.