diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-29 15:33:44 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-29 15:33:44 (GMT) |
commit | 564d2a31a1fd7dfff9a4f6cc2ae814d9307e88a9 (patch) | |
tree | 6e35b7c0091c5cc7514b8740cfaf90234a48bbca /src/declarative | |
parent | 6469ed030a0edbb08b7856c9292fcceb155dff86 (diff) | |
parent | f8560717dd56514269cfb081c7f4b94e231e10d7 (diff) | |
download | Qt-564d2a31a1fd7dfff9a4f6cc2ae814d9307e88a9.zip Qt-564d2a31a1fd7dfff9a4f6cc2ae814d9307e88a9.tar.gz Qt-564d2a31a1fd7dfff9a4f6cc2ae814d9307e88a9.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix text color in some cases of QML and QStaticText
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextlayout.cpp | 15 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextlayout_p.h | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp index cf2ef26..9aef504 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp @@ -72,14 +72,17 @@ class DrawTextItemRecorder: public QPaintEngine public: DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations) : m_inertText(0), m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations), - m_untransformedCoordinates(untransformedCoordinates) + m_untransformedCoordinates(untransformedCoordinates), m_currentColor(Qt::black) { } virtual void updateState(const QPaintEngineState &newState) { - if (newState.state() & QPaintEngine::DirtyPen) + if (newState.state() & QPaintEngine::DirtyPen + && newState.pen().color() != m_currentColor) { m_dirtyPen = true; + m_currentColor = newState.pen().color(); + } } virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) @@ -115,7 +118,7 @@ class DrawTextItemRecorder: public QPaintEngine currentItem.positionOffset = positionOffset; currentItem.useBackendOptimizations = m_useBackendOptimizations; if (m_dirtyPen) - currentItem.color = state->pen().color(); + currentItem.color = m_currentColor; m_inertText->items.append(currentItem); } @@ -172,6 +175,7 @@ class DrawTextItemRecorder: public QPaintEngine bool m_dirtyPen; bool m_useBackendOptimizations; bool m_untransformedCoordinates; + QColor m_currentColor; }; class DrawTextItemDevice: public QPaintDevice @@ -299,7 +303,7 @@ void QDeclarativeTextLayout::clearLayout() QTextLayout::clearLayout(); } -void QDeclarativeTextLayout::prepare(QPainter *painter) +void QDeclarativeTextLayout::prepare() { if (!d || !d->cached) { @@ -308,7 +312,6 @@ void QDeclarativeTextLayout::prepare(QPainter *painter) InertTextPainter *itp = inertTextPainter(); itp->device.begin(d); - itp->painter.setPen(painter->pen()); QTextLayout::draw(&itp->painter, QPointF(0, 0)); glyph_t *glyphPool = d->glyphs.data(); @@ -347,7 +350,7 @@ void QDeclarativeTextLayout::draw(QPainter *painter, const QPointF &p) return; } - prepare(painter); + prepare(); int itemCount = d->items.count(); diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h index 85d333e..d83ce7e 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h @@ -61,7 +61,7 @@ public: void beginLayout(); void clearLayout(); - void prepare(QPainter *); + void prepare(); void draw(QPainter *, const QPointF & = QPointF()); private: |