Fix TextEdit content size calculation
authorJ-P Nurmi <jpnurmi@digia.com>
Tue, 14 May 2013 17:27:20 +0000 (19:27 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 22 May 2013 15:39:44 +0000 (17:39 +0200)
Task-number: QTBUG-31154
Change-Id: I9d3e31352967b99b4bbb38f5819d3d093438ee37
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
src/quick/items/qquicktextedit.cpp

index 7c35565..327b086 100644 (file)
@@ -2164,8 +2164,10 @@ void QQuickTextEdit::updateSize()
             if (d->inLayout)    // probably the result of a binding loop, but by letting it
                 return;         // get this far we'll get a warning to that effect.
         }
-        if (d->document->textWidth() != width())
+        if (d->document->textWidth() != width()) {
             d->document->setTextWidth(width());
+            newWidth = d->document->idealWidth();
+        }
         //### need to confirm cost of always setting these
     } else if (d->wrapMode == NoWrap && d->document->textWidth() != newWidth) {
         d->document->setTextWidth(newWidth); // ### Text does not align if width is not set or the idealWidth exceeds the textWidth (QTextDoc bug)