Skip to content
Permalink
Browse files

Fix more occurances of drawPolygon issues on Windows

(cherry-picked from 4bcd970)
  • Loading branch information
nyalldawson committed Oct 19, 2016
1 parent 1719933 commit 2d79b42158b281da98ac9ba0748d4f989c1549bf
Showing with 19 additions and 2 deletions.
  1. +7 −1 src/core/composer/qgscomposeritem.cpp
  2. +12 −1 src/gui/qgsmapoverviewcanvas.cpp
@@ -524,7 +524,13 @@ void QgsComposerItem::drawSelectionBoxes( QPainter* p )
selectedItemPen.setWidth( 0 );
p->setPen( selectedItemPen );
p->setBrush( Qt::NoBrush );
p->drawPolygon( rect() );

// drawPolygon causes issues on windows - corners of path may be missing resulting in triangles being drawn
// instead of rectangles! (Same cause as #13343)
QPainterPath path;
path.addPolygon( rect() );
p->drawPath( path );

p->restore();
}

@@ -291,6 +291,11 @@ void QgsPanningWidget::setPolygon( const QPolygon& p )
{
if ( p == mPoly ) return;
mPoly = p;

//ensure polygon is closed
if ( mPoly.at( 0 ) != mPoly.at( mPoly.length() - 1 ) )
mPoly.append( mPoly.at( 0 ) );

setGeometry( p.boundingRect() );
update();
}
@@ -303,7 +308,13 @@ void QgsPanningWidget::paintEvent( QPaintEvent* pe )
p.begin( this );
p.setPen( Qt::red );
QPolygonF t = mPoly.translated( -mPoly.boundingRect().left(), -mPoly.boundingRect().top() );
p.drawConvexPolygon( t );

// drawPolygon causes issues on windows - corners of path may be missing resulting in triangles being drawn
// instead of rectangles! (Same cause as #13343)
QPainterPath path;
path.addPolygon( t );
p.drawPath( path );

p.end();
}

0 comments on commit 2d79b42

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