summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-11-03 04:55:46 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-11-03 04:55:46 (GMT)
commitaf15292e4982c11542487d39fc76ccfb8516598f (patch)
treeaa22c66c8f6a0230fdb63162b8794e2d76155bdb /src
parentb2016bbfc9c7389e7b64451417395ceba96af21f (diff)
downloadQt-af15292e4982c11542487d39fc76ccfb8516598f.zip
Qt-af15292e4982c11542487d39fc76ccfb8516598f.tar.gz
Qt-af15292e4982c11542487d39fc76ccfb8516598f.tar.bz2
Regression: QDeclarativeText does not update when text turns empty
Task-number: QTBUG-14865 Reviewed-by: Michael Brasser
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout.cpp13
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout_p.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 8cb47aa..84f276e 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -219,6 +219,7 @@ void QDeclarativeTextPrivate::updateSize()
QFontMetrics fm(font);
if (text.isEmpty()) {
+ q->setImplicitWidth(0);
q->setImplicitHeight(fm.height());
emit q->paintedSizeChanged();
q->update();
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
index 89a2158..db5d75d 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
@@ -285,6 +285,19 @@ void QDeclarativeTextLayout::beginLayout()
QTextLayout::beginLayout();
}
+void QDeclarativeTextLayout::clearLayout()
+{
+ if (d && d->cached) {
+ d->cached = false;
+ d->items.clear();
+ d->positions.clear();
+ d->glyphs.clear();
+ d->chars.clear();
+ d->position = QPointF();
+ }
+ QTextLayout::clearLayout();
+}
+
void QDeclarativeTextLayout::prepare()
{
if (!d || !d->cached) {
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
index 90bf0e0..8b81db3 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
@@ -59,6 +59,7 @@ public:
~QDeclarativeTextLayout();
void beginLayout();
+ void clearLayout();
void prepare();
void draw(QPainter *, const QPointF & = QPointF());