aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qquicktextedit.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-11-29 10:19:01 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-30 04:34:34 +0100
commit3bdefb5c1cf10a38de971c679bee5486bc6bd5f6 (patch)
tree771bf1c51fcf502dd4d951c5d4efbc04b702a692 /src/declarative/items/qquicktextedit.cpp
parent9321a19664ca7409f599b68e3784bbd5bd321a54 (diff)
Add QQuickItem::setImplicitSize()
This allows us to batch up size changes better, leading to fewer layout recalculations. Change-Id: I423113fab78666a99ca05439f852f57c92f6f821 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/declarative/items/qquicktextedit.cpp')
-rw-r--r--src/declarative/items/qquicktextedit.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/declarative/items/qquicktextedit.cpp b/src/declarative/items/qquicktextedit.cpp
index 51231e17de..b40b5c09a1 100644
--- a/src/declarative/items/qquicktextedit.cpp
+++ b/src/declarative/items/qquicktextedit.cpp
@@ -1804,12 +1804,16 @@ void QQuickTextEdit::updateSize()
if (!widthValid() && d->document->textWidth() != newWidth)
d->document->setTextWidth(newWidth); // ### Text does not align if width is not set (QTextDoc bug)
// ### Setting the implicitWidth triggers another updateSize(), and unless there are bindings nothing has changed.
+ qreal iWidth = -1;
if (!widthValid())
- setImplicitWidth(newWidth);
+ iWidth = newWidth;
else if (d->requireImplicitWidth)
- setImplicitWidth(naturalWidth);
+ iWidth = naturalWidth;
qreal newHeight = d->document->isEmpty() ? fm.height() : (int)d->document->size().height();
- setImplicitHeight(newHeight);
+ if (iWidth > -1)
+ setImplicitSize(iWidth, newHeight);
+ else
+ setImplicitHeight(newHeight);
d->paintedSize = QSize(newWidth, newHeight);
emit paintedSizeChanged();