From fb9493870fa3212b0f7a917aa92a0a30d77f3b1e Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 30 Mar 2010 13:47:13 +0200 Subject: Hack .pro files on windows to define QT_NO_EGL Temporary fix until configure.exe can be re-compiled. Reviewed-By: TrustMe --- src/gui/gui.pro | 1 + tests/auto/qgl/qgl.pro | 1 + tests/auto/qglbuffer/qglbuffer.pro | 2 ++ tests/auto/qglthreads/qglthreads.pro | 2 ++ 4 files changed, 6 insertions(+) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index cbdbb5c..b22f732 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -41,6 +41,7 @@ include(math3d/math3d.pri) include(effects/effects.pri) contains(QT_CONFIG, egl): include(egl/egl.pri) +win32:!wince*: DEFINES += QT_NO_EGL embedded: QT += network diff --git a/tests/auto/qgl/qgl.pro b/tests/auto/qgl/qgl.pro index 5f058f9..20f8018 100644 --- a/tests/auto/qgl/qgl.pro +++ b/tests/auto/qgl/qgl.pro @@ -7,6 +7,7 @@ requires(contains(QT_CONFIG,opengl)) QT += opengl contains(QT_CONFIG,egl):DEFINES += QGL_EGL +win32:!wince*: DEFINES += QT_NO_EGL SOURCES += tst_qgl.cpp RESOURCES = qgl.qrc diff --git a/tests/auto/qglbuffer/qglbuffer.pro b/tests/auto/qglbuffer/qglbuffer.pro index 07d05bb..5627d2d 100644 --- a/tests/auto/qglbuffer/qglbuffer.pro +++ b/tests/auto/qglbuffer/qglbuffer.pro @@ -6,4 +6,6 @@ load(qttest_p4) requires(contains(QT_CONFIG,opengl)) QT += opengl +win32:!wince*: DEFINES += QT_NO_EGL + SOURCES += tst_qglbuffer.cpp diff --git a/tests/auto/qglthreads/qglthreads.pro b/tests/auto/qglthreads/qglthreads.pro index 73b75d4..883eef2 100644 --- a/tests/auto/qglthreads/qglthreads.pro +++ b/tests/auto/qglthreads/qglthreads.pro @@ -2,6 +2,8 @@ load(qttest_p4) requires(contains(QT_CONFIG,opengl)) QT += opengl +win32:!wince*: DEFINES += QT_NO_EGL + HEADERS += tst_qglthreads.h SOURCES += tst_qglthreads.cpp -- cgit v0.12 From 6e173f50f6b04057040b1e5c4125e3f1b6f885ce Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Mar 2010 13:57:10 +0200 Subject: 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 --- src/gui/painting/qpainter.cpp | 10 +++++----- 1 file 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::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(); -- cgit v0.12 From 1dece0c73feb0307f90acdc127891fa6313da4cd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Mar 2010 14:20:56 +0200 Subject: Support the pen set on the painter in QStaticText when using rich text When using rich text, QStaticText should still respect the painter's pen color as the default. Since QTextDocument does not respect the pen set on the painter, we need to set its default style sheet to include the pen color as well. Reviewed-by: Olivier --- src/gui/text/qstatictext.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 45252d8..5f31ef0 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -584,6 +584,11 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p) textLayout.draw(p, topLeftPosition); } else { QTextDocument document; + QColor color = p->pen().color(); + document.setDefaultStyleSheet(QString::fromLatin1("body { color: #%1%2%3 }") + .arg(QString::number(color.red(), 16), 2, QLatin1Char('0')) + .arg(QString::number(color.green(), 16), 2, QLatin1Char('0')) + .arg(QString::number(color.blue(), 16), 2, QLatin1Char('0'))); document.setDefaultFont(font); document.setDocumentMargin(0.0); if (textWidth >= 0.0) -- cgit v0.12