diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-07-20 02:26:13 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-07-20 02:26:13 (GMT) |
commit | 6c3cf7e2c5868bc77ffa66059889eda3132531b3 (patch) | |
tree | e82be2bbef65d4fcd0a505793c8eaae24a21d97f | |
parent | b2f90dedbeac285338af07fbffaec97ceaf0876f (diff) | |
download | Qt-6c3cf7e2c5868bc77ffa66059889eda3132531b3.zip Qt-6c3cf7e2c5868bc77ffa66059889eda3132531b3.tar.gz Qt-6c3cf7e2c5868bc77ffa66059889eda3132531b3.tar.bz2 |
Ensure the boundingRect() of Text is correctly calculated.
We need to create our cached image in boundingRect() if it doesn't
already exist, to prevents painting errors.
Reviewed-by: Warwick Allison
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetext.cpp | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index d63d633..ec8bfb5 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -716,6 +716,8 @@ QRectF QDeclarativeText::boundingRect() const // Could include font max left/right bearings to either side of rectangle. if (d->cache || d->style != Normal) { + QDeclarativeTextPrivate *dd = const_cast<QDeclarativeTextPrivate *>(d); + dd->checkImgCache(); switch (d->hAlign) { case AlignLeft: x = 0; diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 80198eb..53862ec 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -246,6 +246,7 @@ void tst_qdeclarativetext::width() QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); + QVERIFY(textObject->boundingRect().width() > 0); QCOMPARE(textObject->width(), qreal(metricWidth)); QVERIFY(textObject->textFormat() == QDeclarativeText::AutoText); // setting text doesn't change format } |