Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix more occurances of drawPolygon issues on Windows
  • Loading branch information
nyalldawson committed Oct 19, 2016
1 parent 4b398d3 commit 4bcd970
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/core/composer/qgscomposeritem.cpp
Expand Up @@ -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();
}

Expand Down
13 changes: 12 additions & 1 deletion src/gui/qgsmapoverviewcanvas.cpp
Expand Up @@ -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();
}
Expand All @@ -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();
}

Expand Down

0 comments on commit 4bcd970

Please sign in to comment.