summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-06-23 00:29:15 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-06-23 00:29:15 +0200
commit4032ac6653ca910bb6ffa3aeaaa33dc6630600d4 (patch)
treed24fac408cef78807e613e2809c14b668aa1e592
parent0246e68b6b3d730d3f9a7bcf11ee6ef1044df155 (diff)
downloadkube-4032ac6653ca910bb6ffa3aeaaa33dc6630600d4.tar.gz
kube-4032ac6653ca910bb6ffa3aeaaa33dc6630600d4.zip
Slightly better sizing in the composer
-rw-r--r--framework/qml/TextEditor.qml11
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}