aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/texteditor/qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-08-11 22:41:11 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-08-12 10:51:30 +0000
commit9a6bdf52a387b9266f78f2576dfee9bbf7285730 (patch)
tree0d9ec6240c03ef8f2274d86423890c868cf7367d /examples/quickcontrols2/texteditor/qml
parent90842fdc865c3b7e9937bbd75f3fd5d74ec588ef (diff)
texteditor: replace setFileUrl() with load()
This allows to remove the text property to avoid storing the whole document's initial content for no real purpose. Change-Id: Iad59576b5304be9739c1dfb0a7d4c263323b0edb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples/quickcontrols2/texteditor/qml')
-rw-r--r--examples/quickcontrols2/texteditor/qml/texteditor.qml8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/quickcontrols2/texteditor/qml/texteditor.qml b/examples/quickcontrols2/texteditor/qml/texteditor.qml
index ca4f196d..21a187ba 100644
--- a/examples/quickcontrols2/texteditor/qml/texteditor.qml
+++ b/examples/quickcontrols2/texteditor/qml/texteditor.qml
@@ -163,7 +163,7 @@ ApplicationWindow {
id: openDialog
fileMode: FileDialog.OpenFile
nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)"]
- onFileSelected: document.fileUrl = file
+ onFileSelected: document.load(file)
}
FileDialog {
@@ -361,7 +361,10 @@ ApplicationWindow {
textColor: colorDialog.currentColor
// TODO: if we don't do this, e.g. the bold button won't be checked
// when it should be (the title is bold)
- Component.onCompleted: document.fileUrl = "qrc:/texteditor.html"
+ Component.onCompleted: document.load("qrc:/texteditor.html")
+ onLoaded: {
+ textArea.text = text
+ }
onError: {
errorDialog.text = message
errorDialog.visible = true
@@ -375,7 +378,6 @@ ApplicationWindow {
TextArea.flickable: TextArea {
id: textArea
- text: document.text
textFormat: Qt.RichText
wrapMode: TextArea.Wrap
focus: true