diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-12-17 01:10:07 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-12-17 01:10:07 (GMT) |
commit | e1111688bba1abbc24762b2a96d79fcd86599fa7 (patch) | |
tree | a8873bded422577dbe304765b06c4116ddaacbc2 /src/declarative/graphicsitems | |
parent | 152b06c18bf0ca5ae8607efabcb0db29eb81c78b (diff) | |
download | Qt-e1111688bba1abbc24762b2a96d79fcd86599fa7.zip Qt-e1111688bba1abbc24762b2a96d79fcd86599fa7.tar.gz Qt-e1111688bba1abbc24762b2a96d79fcd86599fa7.tar.bz2 |
Avoid calling qgi::update() until after component complete
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstext.cpp | 25 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstext_p_p.h | 6 |
2 files changed, 15 insertions, 16 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicstext.cpp b/src/declarative/graphicsitems/qmlgraphicstext.cpp index 6ec72ef..52d68fd 100644 --- a/src/declarative/graphicsitems/qmlgraphicstext.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstext.cpp @@ -144,9 +144,8 @@ void QmlGraphicsText::setFont(const QFont &font) Q_D(QmlGraphicsText); d->font = font; - d->imgDirty = true; d->updateSize(); - update(); + d->markImgDirty(); } void QmlGraphicsText::setText(const QString &n) @@ -171,10 +170,9 @@ void QmlGraphicsText::setText(const QString &n) } d->text = n; - d->imgDirty = true; d->updateSize(); + d->markImgDirty(); emit textChanged(d->text); - update(); } /*! @@ -197,9 +195,8 @@ void QmlGraphicsText::setColor(const QColor &color) if (d->color == color) return; - d->imgDirty = true; d->color = color; - update(); + d->markImgDirty(); } /*! @@ -252,9 +249,8 @@ void QmlGraphicsText::setStyle(QmlGraphicsText::TextStyle style) if (d->style == style) return; - d->imgDirty = true; d->style = style; - update(); + d->markImgDirty(); } void QmlGraphicsText::setStyleColor(const QColor &color) @@ -263,9 +259,8 @@ void QmlGraphicsText::setStyleColor(const QColor &color) if (d->styleColor == color) return; - d->imgDirty = true; d->styleColor = color; - update(); + d->markImgDirty(); } /*! @@ -345,8 +340,8 @@ void QmlGraphicsText::setWrap(bool w) d->wrap = w; - d->imgDirty = true; d->updateSize(); + d->markImgDirty(); } /*! @@ -401,9 +396,8 @@ void QmlGraphicsText::setTextFormat(TextFormat format) if (wasRich && !d->richText) { //### delete control? (and vice-versa below) - d->imgDirty = true; d->updateSize(); - update(); + d->markImgDirty(); } else if (!wasRich && d->richText) { if (!d->doc) { @@ -413,9 +407,8 @@ void QmlGraphicsText::setTextFormat(TextFormat format) d->doc->setDocumentMargin(0); } d->doc->setHtml(d->text); - d->imgDirty = true; d->updateSize(); - update(); + d->markImgDirty(); } d->format = format; } @@ -450,8 +443,8 @@ void QmlGraphicsText::setElideMode(QmlGraphicsText::TextElideMode mode) d->elideMode = mode; - d->imgDirty = true; d->updateSize(); + d->markImgDirty(); } void QmlGraphicsText::geometryChanged(const QRectF &newGeometry, diff --git a/src/declarative/graphicsitems/qmlgraphicstext_p_p.h b/src/declarative/graphicsitems/qmlgraphicstext_p_p.h index 6fbee50..7e77c69 100644 --- a/src/declarative/graphicsitems/qmlgraphicstext_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicstext_p_p.h @@ -81,6 +81,12 @@ public: ~QmlGraphicsTextPrivate(); void updateSize(); + void markImgDirty() { + Q_Q(QmlGraphicsText); + imgDirty = true; + if (q->isComponentComplete()) + q->update(); + } void checkImgCache(); void drawOutline(); |