diff options
-rw-r--r-- | framework/qml/TextEditor.qml | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/framework/qml/TextEditor.qml b/framework/qml/TextEditor.qml index 080543f9..9c2298b6 100644 --- a/framework/qml/TextEditor.qml +++ b/framework/qml/TextEditor.qml | |||
@@ -30,15 +30,11 @@ ScrollView { | |||
30 | id: flick | 30 | id: flick |
31 | 31 | ||
32 | contentWidth: root.viewport.width | 32 | contentWidth: root.viewport.width |
33 | contentHeight: edit.height | 33 | contentHeight: Math.max(edit.contentHeight + edit.topPadding + edit.bottomPadding, flick.height) |
34 | clip: true | 34 | clip: true |
35 | 35 | ||
36 | function ensureVisible(r) | 36 | function ensureVisible(r) |
37 | { | 37 | { |
38 | if (contentX >= r.x) | ||
39 | contentX = r.x; | ||
40 | else if (contentX + width <= r.x + r.width) | ||
41 | contentX = r.x+r.width-width; | ||
42 | if (contentY >= r.y) | 38 | if (contentY >= r.y) |
43 | contentY = r.y; | 39 | contentY = r.y; |
44 | else if (contentY + height <= r.y + r.height) | 40 | else if (contentY + height <= r.y + r.height) |
@@ -49,10 +45,11 @@ ScrollView { | |||
49 | //TODO drop all sizes and use the following once we have qt 5.9 | 45 | //TODO drop all sizes and use the following once we have qt 5.9 |
50 | // Controls2.TextArea.flickable: Kube.TextArea { | 46 | // Controls2.TextArea.flickable: Kube.TextArea { |
51 | id: edit | 47 | id: edit |
52 | width: flick.width | 48 | width: flick.contentWidth - edit.leftPadding - edit.rightPadding |
53 | height: edit.contentHeight > flick.height ? edit.contentHeight : flick.height | 49 | height: flick.contentHeight |
54 | selectByMouse: true | 50 | selectByMouse: true |
55 | onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) | 51 | onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) |
52 | wrapMode: TextEdit.Wrap | ||
56 | } | 53 | } |
57 | } | 54 | } |
58 | } | 55 | } |