Skip to content

Commit 3af8320

Browse files
thomasjef-n
thomas
authored andcommittedJul 20, 2012
apply #4819: use QPainterPath instead of QPolygonF for highlighting
1 parent 8d5d60b commit 3af8320

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed
 

‎src/app/qgshighlight.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "qgsmaprenderer.h"
2020
#include "qgscoordinatetransform.h"
2121
#include "qgsvectorlayer.h"
22-
#include <QPainter>
2322

2423
/*!
2524
\class QgsHighlight
@@ -93,11 +92,11 @@ void QgsHighlight::paintLine( QPainter *p, QgsPolyline line )
9392

9493
void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )
9594
{
96-
QPolygonF poly;
95+
// OddEven fill rule by default
96+
QPainterPath path;
9797

98-
// just ring outlines, no fill
9998
p->setPen( mPen );
100-
p->setBrush( Qt::NoBrush );
99+
p->setBrush( mBrush );
101100

102101
for ( int i = 0; i < polygon.size(); i++ )
103102
{
@@ -110,18 +109,10 @@ void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )
110109

111110
ring[ polygon[i].size()] = ring[ 0 ];
112111

113-
p->drawPolygon( ring );
114-
115-
if ( i == 0 )
116-
poly = ring;
117-
else
118-
poly = poly.subtracted( ring );
112+
path.addPolygon( ring );
119113
}
120114

121-
// just fill, no outline
122-
p->setPen( Qt::NoPen );
123-
p->setBrush( mBrush );
124-
p->drawPolygon( poly );
115+
p->drawPath( path );
125116
}
126117

127118
/*!

‎src/app/qgshighlight.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <QList>
2222
#include <QPen>
2323
#include <QPainter>
24+
#include <QPainterPath>
2425

2526
class QgsVectorLayer;
2627

0 commit comments

Comments
 (0)
Please sign in to comment.