summaryrefslogtreecommitdiffstats
path: root/framework/qml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml')
-rw-r--r--framework/qml/TextEditor.qml37
1 files changed, 15 insertions, 22 deletions
diff --git a/framework/qml/TextEditor.qml b/framework/qml/TextEditor.qml
index 0ef91157..d80bebb9 100644
--- a/framework/qml/TextEditor.qml
+++ b/framework/qml/TextEditor.qml
@@ -18,32 +18,25 @@
18 */ 18 */
19 19
20import QtQuick 2.7 20import QtQuick 2.7
21import QtQuick.Controls 1.3 21import QtQuick.Controls 2.2
22 22
23import org.kube.framework 1.0 as Kube 23import org.kube.framework 1.0 as Kube
24 24
25ScrollView { 25Kube.ScrollHelper {
26 id: root 26 id: scrollHelper
27 property alias text: edit.text 27 property alias text: edit.text
28 flickable: root
29 Flickable {
30 id: root
31 anchors.fill: parent
32 ScrollBar.vertical: ScrollBar {}
28 33
29 horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff 34 Kube.TextArea {
30 35 id: edit
31 function ensureVisible(r) 36 anchors.fill: parent
32 { 37 selectByMouse: true
33 if (flickableItem.contentY >= r.y) 38 wrapMode: TextEdit.Wrap
34 flickableItem.contentY = r.y; 39 }
35 else if (flickableItem.contentY + height <= r.y + r.height) 40 TextArea.flickable: edit
36 flickableItem.contentY = r.y + r.height - height + edit.padding;
37 }
38
39 Kube.TextArea {
40 //TODO drop all sizes and use the following once we have qt 5.9
41 // Controls2.TextArea.flickable: Kube.TextArea {
42 id: edit
43 width: root.viewport.width
44 height: Math.max(edit.contentHeight + edit.topPadding + edit.bottomPadding, root.height)
45 selectByMouse: true
46 onCursorRectangleChanged: root.ensureVisible(cursorRectangle)
47 wrapMode: TextEdit.Wrap
48 } 41 }
49} 42}