From c02a4761b1ee4943c392bc6fce2fe906aead788a Mon Sep 17 00:00:00 2001
From: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Date: Sun, 10 Feb 2013 12:18:17 +0100
Subject: [PATCH] Improve TextArea size calculation

The text area scroll bars did not include the text document margins.

Change-Id: Id5edd6595bde2a50872dbad1473cdf0d8649a7ce
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
---
 src/qtdesktop/TextArea.qml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/qtdesktop/TextArea.qml b/src/qtdesktop/TextArea.qml
index 6d0f08a62..405f9ff02 100644
--- a/src/qtdesktop/TextArea.qml
+++ b/src/qtdesktop/TextArea.qml
@@ -712,7 +712,6 @@ ScrollArea {
     height: 120
 
     flickableItem.contentWidth: edit.paintedWidth + (2 * documentMargins)
-
     frame: true
 
     Accessible.role: Accessible.EditableText
@@ -744,6 +743,7 @@ ScrollArea {
         selectedTextColor: palette.highlightedText
         wrapMode: TextEdit.WordWrap
         width: area.viewport.width - (2 * documentMargins)
+        height: paintedHeight + 2 * documentMargins
         x: documentMargins
         y: documentMargins
 
@@ -754,8 +754,6 @@ ScrollArea {
         KeyNavigation.tab: area.tabChangesFocus ? area.KeyNavigation.tab : null
         KeyNavigation.backtab: area.tabChangesFocus ? area.KeyNavigation.backtab : null
 
-        onContentSizeChanged: { area.flickableItem.contentWidth = paintedWidth + (2 * documentMargins) }
-
         // keep textcursor within scrollarea
         onCursorPositionChanged: {
             if (cursorRectangle.y >= flickableItem.contentY + viewport.height - 1.5*cursorRectangle.height - documentMargins)
-- 
GitLab