summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qpainterpath_p.h1
-rw-r--r--tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp12
3 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 38acc66ba4..9479cadd8f 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1369,7 +1369,7 @@ void QPainterPath::addRegion(const QRegion &region)
*/
Qt::FillRule QPainterPath::fillRule() const
{
- return isEmpty() ? Qt::OddEvenFill : d_func()->fillRule;
+ return !d_func() ? Qt::OddEvenFill : d_func()->fillRule;
}
/*!
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index 24feaf410b..c283b7f27e 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -292,7 +292,6 @@ inline void QPainterPathPrivate::clear()
elements.clear();
cStart = 0;
- fillRule = Qt::OddEvenFill;
bounds = {};
controlBounds = {};
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index f96ed563d3..95caa60910 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -173,8 +173,18 @@ void tst_QPainterPath::clear()
p1.setFillRule(Qt::WindingFill);
QVERIFY(p1 != p3);
p1.clear();
- QCOMPARE(p1.fillRule(), Qt::OddEvenFill);
+ QVERIFY(p1 != p3);
+ p1.setFillRule(Qt::OddEvenFill);
QCOMPARE(p1, p2);
+
+ QPainterPath p4;
+ QCOMPARE(p4.fillRule(), Qt::OddEvenFill);
+ p4.setFillRule(Qt::WindingFill);
+ QCOMPARE(p4.fillRule(), Qt::WindingFill);
+ p4.clear();
+ QCOMPARE(p4.fillRule(), Qt::WindingFill);
+ p4 = QPainterPath();
+ QCOMPARE(p4.fillRule(), Qt::OddEvenFill);
}
void tst_QPainterPath::reserveAndCapacity()