summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-07-07 05:09:13 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-07-07 05:13:11 (GMT)
commit760dd5919ac3bafb5f17b700d5da9b3609318bbb (patch)
tree2363f4fa73ebdfedae275b59e78177525c030c79
parente429284e7d6f6639d5e07c113c45f400a02a8fa1 (diff)
downloadQt-760dd5919ac3bafb5f17b700d5da9b3609318bbb.zip
Qt-760dd5919ac3bafb5f17b700d5da9b3609318bbb.tar.gz
Qt-760dd5919ac3bafb5f17b700d5da9b3609318bbb.tar.bz2
QDeclarativeText optimization.
updateSize() shouldn't trigger another updateSize(). Reviewed-by: Martin Jones
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext_p_p.h3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 200a680..9a281e5 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -772,7 +772,7 @@ void QDeclarativeText::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
Q_D(QDeclarativeText);
- if (newGeometry.width() != oldGeometry.width()) {
+ if (!d->internalWidthUpdate && newGeometry.width() != oldGeometry.width()) {
if (d->wrapMode != QDeclarativeText::NoWrap || d->elideMode != QDeclarativeText::ElideNone) {
//re-elide if needed
if (d->singleline && d->elideMode != QDeclarativeText::ElideNone &&
@@ -872,7 +872,9 @@ void QDeclarativeTextPrivate::updateSize()
q->setBaselineOffset(fm.ascent() + yoff);
//### need to comfirm cost of always setting these for richText
+ internalWidthUpdate = true;
q->setImplicitWidth(size.width());
+ internalWidthUpdate = false;
q->setImplicitHeight(size.height());
emit q->paintedSizeChanged();
} else {
diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
index 51a5514..48552a7 100644
--- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
@@ -72,7 +72,7 @@ public:
QDeclarativeTextPrivate()
: color((QRgb)0), style(QDeclarativeText::Normal),
hAlign(QDeclarativeText::AlignLeft), vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone),
- imgDirty(true), dirty(true), richText(false), singleline(false), cache(true), doc(0),
+ imgDirty(true), dirty(true), richText(false), singleline(false), cache(true), internalWidthUpdate(false), doc(0),
format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap)
{
#if defined(QML_NO_TEXT_CACHE)
@@ -119,6 +119,7 @@ public:
bool richText:1;
bool singleline:1;
bool cache:1;
+ bool internalWidthUpdate:1;
QTextDocumentWithImageResources *doc;
QTextLayout layout;
QSize cachedLayoutSize;