aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/texteditor/qml/texteditor.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quickcontrols2/texteditor/qml/texteditor.qml')
-rw-r--r--examples/quickcontrols2/texteditor/qml/texteditor.qml10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/quickcontrols2/texteditor/qml/texteditor.qml b/examples/quickcontrols2/texteditor/qml/texteditor.qml
index 6c95335b..b1485582 100644
--- a/examples/quickcontrols2/texteditor/qml/texteditor.qml
+++ b/examples/quickcontrols2/texteditor/qml/texteditor.qml
@@ -173,7 +173,7 @@ ApplicationWindow {
id: openDialog
fileMode: FileDialog.OpenFile
selectedNameFilter.index: 1
- nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)"]
+ nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)", "Markdown files (*.md *.markdown)"]
folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
onAccepted: document.load(file)
}
@@ -383,8 +383,14 @@ ApplicationWindow {
selectionStart: textArea.selectionStart
selectionEnd: textArea.selectionEnd
textColor: colorDialog.color
- Component.onCompleted: document.load("qrc:/texteditor.html")
+ Component.onCompleted: {
+ if (Qt.application.arguments.length === 2)
+ document.load("file:" + Qt.application.arguments[1]);
+ else
+ document.load("qrc:/texteditor.html")
+ }
onLoaded: {
+ textArea.textFormat = format
textArea.text = text
}
onError: {