summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-08 23:15:37 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-08 23:15:37 (GMT)
commit0d3531e2405b77b9f3acff437b44a7b96d64f586 (patch)
tree71fc6f5672b99c39a923c4223f3b2db608621f6d
parent526705430be6371166464689e970752a5ce41ed6 (diff)
parente1a97ef26c67a844be7c05af94270b25f013a673 (diff)
downloadQt-0d3531e2405b77b9f3acff437b44a7b96d64f586.zip
Qt-0d3531e2405b77b9f3acff437b44a7b96d64f586.tar.gz
Qt-0d3531e2405b77b9f3acff437b44a7b96d64f586.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Don't cause repaints during painting in Text element
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp11
2 files changed, 18 insertions, 9 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index fd3a1f7..14194a0 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -429,6 +429,9 @@ void QDeclarativeText::setStyle(QDeclarativeText::TextStyle style)
if (d->style == style)
return;
+ // changing to/from Normal requires the boundingRect() to change
+ if (isComponentComplete() && (d->style == Normal || style == Normal))
+ prepareGeometryChange();
d->style = style;
d->markImgDirty();
emit styleChanged(d->style);
@@ -494,8 +497,9 @@ void QDeclarativeText::setHAlign(HAlignment align)
if (d->hAlign == align)
return;
+ if (isComponentComplete())
+ prepareGeometryChange();
d->hAlign = align;
- update();
emit horizontalAlignmentChanged(align);
}
@@ -511,8 +515,9 @@ void QDeclarativeText::setVAlign(VAlignment align)
if (d->vAlign == align)
return;
+ if (isComponentComplete())
+ prepareGeometryChange();
d->vAlign = align;
- update();
emit verticalAlignmentChanged(align);
}
@@ -805,7 +810,6 @@ void QDeclarativeTextPrivate::updateSize()
else
doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug)
dy -= (int)doc->size().height();
- q->prepareGeometryChange();
QSize dsize = doc->size().toSize();
if (dsize != cachedLayoutSize) {
q->prepareGeometryChange();
@@ -882,8 +886,6 @@ void QDeclarativeTextPrivate::drawOutline()
ppm.drawPixmap(pos, imgCache);
ppm.end();
- if (imgCache.size() != img.size())
- q_func()->prepareGeometryChange();
imgCache = img;
}
@@ -902,8 +904,6 @@ void QDeclarativeTextPrivate::drawOutline(int yOffset)
ppm.drawPixmap(pos, imgCache);
ppm.end();
- if (imgCache.size() != img.size())
- q_func()->prepareGeometryChange();
imgCache = img;
}
@@ -1054,8 +1054,6 @@ void QDeclarativeTextPrivate::checkImgCache()
if (style != QDeclarativeText::Normal)
imgStyleCache = wrappedTextImage(true); //### should use styleColor
}
- if (imgCache.size() != newImgCache.size())
- q_func()->prepareGeometryChange();
imgCache = newImgCache;
if (!empty)
switch (style) {
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 658f381..f683d98 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -608,6 +608,17 @@ void tst_qdeclarativetext::style()
QCOMPARE((int)textObject->style(), (int)styles.at(i));
QCOMPARE(textObject->styleColor(), QColor("white"));
}
+ QString componentStr = "import Qt 4.7\nText { text: \"Hello World\" }";
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
+
+ QRectF brPre = textObject->boundingRect();
+ textObject->setStyle(QDeclarativeText::Outline);
+ QRectF brPost = textObject->boundingRect();
+
+ QVERIFY(brPre.width() < brPost.width());
+ QVERIFY(brPre.height() < brPost.height());
}
void tst_qdeclarativetext::color()