diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-03-30 11:57:10 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-03-30 12:36:06 (GMT) |
commit | 6e173f50f6b04057040b1e5c4125e3f1b6f885ce (patch) | |
tree | 44b818583c23179a7efd2020beb2e2f88759e9af /src | |
parent | 6cc6ca434f0ff63273c3fd3da80803f39c888e91 (diff) | |
download | Qt-6e173f50f6b04057040b1e5c4125e3f1b6f885ce.zip Qt-6e173f50f6b04057040b1e5c4125e3f1b6f885ce.tar.gz Qt-6e173f50f6b04057040b1e5c4125e3f1b6f885ce.tar.bz2 |
Fix setting font for QStaticText on Linux and Mac
When using the fallback in QStaticText we have to update its font
to the current painter's font, otherwise we will override the painter's
font with the one cached in the QStaticText object.
Reviewed-by: Olivier
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 7b5fcc2..898a996 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5844,6 +5844,11 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText QStaticTextPrivate *staticText_d = const_cast<QStaticTextPrivate *>(QStaticTextPrivate::get(&staticText)); + if (font() != staticText_d->font) { + staticText_d->font = font(); + staticText_d->needsRelayout = true; + } + // If we don't have an extended paint engine, or if the painter is projected, // we go through standard code path if (d->extended == 0 || !d->state->matrix.isAffine()) { @@ -5880,11 +5885,6 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText staticTextNeedsReinit = true; } - if (font() != staticText_d->font) { - staticText_d->font = font(); - staticTextNeedsReinit = true; - } - // Recreate the layout of the static text because the matrix or font has changed if (staticTextNeedsReinit) staticText_d->init(); |