diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-06 09:57:20 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-06 10:41:24 +0200 |
commit | ed277f30c8a95eadfc4a351b032ded333783e3b5 (patch) | |
tree | c29278dc04ac6166f5fdc32b24db73542112455b /framework/qml/TextEditor.qml | |
parent | 44f1baac26944c1c5061fadf163846958095a425 (diff) | |
download | kube-ed277f30c8a95eadfc4a351b032ded333783e3b5.tar.gz kube-ed277f30c8a95eadfc4a351b032ded333783e3b5.zip |
TextEditor html conversion and testrunner
Diffstat (limited to 'framework/qml/TextEditor.qml')
-rw-r--r-- | framework/qml/TextEditor.qml | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/framework/qml/TextEditor.qml b/framework/qml/TextEditor.qml index 570bc322..609b85db 100644 --- a/framework/qml/TextEditor.qml +++ b/framework/qml/TextEditor.qml | |||
@@ -39,6 +39,19 @@ FocusScope { | |||
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | onHtmlEnabledChanged: { | ||
43 | if (htmlEnabled) { | ||
44 | var t = document.htmlText | ||
45 | edit.textFormat = Qt.RichText | ||
46 | edit.text = t | ||
47 | } else { | ||
48 | var t = document.plainText | ||
49 | edit.textFormat = Qt.PlainText | ||
50 | edit.font.bold = false | ||
51 | edit.text = t | ||
52 | } | ||
53 | } | ||
54 | |||
42 | Kube.DocumentHandler { | 55 | Kube.DocumentHandler { |
43 | id: document | 56 | id: document |
44 | document: edit.textDocument | 57 | document: edit.textDocument |
@@ -92,7 +105,6 @@ FocusScope { | |||
92 | focus: true | 105 | focus: true |
93 | selectByMouse: true | 106 | selectByMouse: true |
94 | wrapMode: TextEdit.WordWrap | 107 | wrapMode: TextEdit.WordWrap |
95 | textFormat: root.htmlEnabled ? Qt.RichText : Qt.PlainText | ||
96 | onCursorRectangleChanged: flickableItem.ensureVisible(cursorRectangle) | 108 | onCursorRectangleChanged: flickableItem.ensureVisible(cursorRectangle) |
97 | 109 | ||
98 | color: Kube.Colors.textColor | 110 | color: Kube.Colors.textColor |