summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-08-27 09:13:16 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2010-09-02 06:03:10 (GMT)
commit704e71882d09e30cef4d620cebba60ba1c0d85c0 (patch)
tree18cf06bb88262b6ac73d6694c16aa65cb8102048
parent8bdfccead3fbe3a9cba88535563e84453b2da93d (diff)
downloadQt-704e71882d09e30cef4d620cebba60ba1c0d85c0.zip
Qt-704e71882d09e30cef4d620cebba60ba1c0d85c0.tar.gz
Qt-704e71882d09e30cef4d620cebba60ba1c0d85c0.tar.bz2
Apparently QPen::brush() can't return a NoBrush for a NoPen.
There are explicit tests in qdatastream for this. IMO it's wrong, wrong, wrong, but it's currently abused in the SVG module so we can't change it. Reviewed-by: Gunnar (cherry picked from commit bdcfcc607c1a6744cf1b35eca0914fa96e70071c)
-rw-r--r--src/gui/painting/qpainter.cpp8
-rw-r--r--tests/auto/qpen/tst_qpen.cpp8
2 files changed, 4 insertions, 12 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index be90006..ee590a4 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -696,9 +696,9 @@ void QPainterPrivate::updateEmulationSpecifier(QPainterState *s)
skip = false;
- QBrush penBrush = s->pen.brush();
- Qt::BrushStyle brushStyle = s->brush.style();
- Qt::BrushStyle penBrushStyle = penBrush.style();
+ QBrush penBrush = (qpen_style(s->pen) == Qt::NoPen) ? QBrush(Qt::NoBrush) : qpen_brush(s->pen);
+ Qt::BrushStyle brushStyle = qbrush_style(s->brush);
+ Qt::BrushStyle penBrushStyle = qbrush_style(penBrush);
alpha = (penBrushStyle != Qt::NoBrush
&& (penBrushStyle < Qt::LinearGradientPattern && penBrush.color().alpha() != 255)
&& !penBrush.isOpaque())
@@ -5907,7 +5907,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
// Recreate the layout of the static text because the matrix or font has changed
if (staticTextNeedsReinit)
- staticText_d->init();
+ staticText_d->init();
if (transformedPosition != staticText_d->position) { // Translate to actual position
QFixed fx = QFixed::fromReal(transformedPosition.x());
diff --git a/tests/auto/qpen/tst_qpen.cpp b/tests/auto/qpen/tst_qpen.cpp
index 6ca4e13..b0c2cad 100644
--- a/tests/auto/qpen/tst_qpen.cpp
+++ b/tests/auto/qpen/tst_qpen.cpp
@@ -67,7 +67,6 @@ private slots:
void constructor();
void constructor_data();
- void noPenNoBrush();
};
// Testing get/set functions
@@ -214,12 +213,5 @@ void tst_QPen::stream()
QCOMPARE(pen, cmp);
}
-void tst_QPen::noPenNoBrush()
-{
- QPen pen;
- pen.setStyle(Qt::NoPen);
- QVERIFY(pen.brush().style() == Qt::NoBrush);
-}
-
QTEST_APPLESS_MAIN(tst_QPen)
#include "tst_qpen.moc"