Skip to content
Permalink
Browse files

apply #4819: use QPainterPath instead of QPolygonF for highlighting

  • Loading branch information
thomas authored and jef-n committed Jul 20, 2012
1 parent 8d5d60b commit 3af8320788404e5f2249fb970d7b26f08dcad8c4
Showing with 6 additions and 14 deletions.
  1. +5 −14 src/app/qgshighlight.cpp
  2. +1 −0 src/app/qgshighlight.h
@@ -19,7 +19,6 @@
#include "qgsmaprenderer.h"
#include "qgscoordinatetransform.h"
#include "qgsvectorlayer.h"
#include <QPainter>

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

void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )
{
QPolygonF poly;
// OddEven fill rule by default
QPainterPath path;

// just ring outlines, no fill
p->setPen( mPen );
p->setBrush( Qt::NoBrush );
p->setBrush( mBrush );

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

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

p->drawPolygon( ring );

if ( i == 0 )
poly = ring;
else
poly = poly.subtracted( ring );
path.addPolygon( ring );
}

// just fill, no outline
p->setPen( Qt::NoPen );
p->setBrush( mBrush );
p->drawPolygon( poly );
p->drawPath( path );
}

/*!
@@ -21,6 +21,7 @@
#include <QList>
#include <QPen>
#include <QPainter>
#include <QPainterPath>

class QgsVectorLayer;

0 comments on commit 3af8320

Please sign in to comment.
You can’t perform that action at this time.