Skip to content
Permalink
Browse files

Fix more occurances of drawPolygon issues on Windows

  • Loading branch information
nyalldawson committed Oct 19, 2016
1 parent 4b398d3 commit 4bcd97066f0c52f6f4f95adc665193bca0ab4a93
Showing with 19 additions and 2 deletions.
  1. +7 −1 src/core/composer/qgscomposeritem.cpp
  2. +12 −1 src/gui/qgsmapoverviewcanvas.cpp
@@ -525,7 +525,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 4bcd970

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