Skip to content

Commit 4bcd970

Browse files
committed
Fix more occurances of drawPolygon issues on Windows
1 parent 4b398d3 commit 4bcd970

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/core/composer/qgscomposeritem.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,13 @@ void QgsComposerItem::drawSelectionBoxes( QPainter* p )
525525
selectedItemPen.setWidth( 0 );
526526
p->setPen( selectedItemPen );
527527
p->setBrush( Qt::NoBrush );
528-
p->drawPolygon( rect() );
528+
529+
// drawPolygon causes issues on windows - corners of path may be missing resulting in triangles being drawn
530+
// instead of rectangles! (Same cause as #13343)
531+
QPainterPath path;
532+
path.addPolygon( rect() );
533+
p->drawPath( path );
534+
529535
p->restore();
530536
}
531537

src/gui/qgsmapoverviewcanvas.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ void QgsPanningWidget::setPolygon( const QPolygon& p )
291291
{
292292
if ( p == mPoly ) return;
293293
mPoly = p;
294+
295+
//ensure polygon is closed
296+
if ( mPoly.at( 0 ) != mPoly.at( mPoly.length() - 1 ) )
297+
mPoly.append( mPoly.at( 0 ) );
298+
294299
setGeometry( p.boundingRect() );
295300
update();
296301
}
@@ -303,7 +308,13 @@ void QgsPanningWidget::paintEvent( QPaintEvent* pe )
303308
p.begin( this );
304309
p.setPen( Qt::red );
305310
QPolygonF t = mPoly.translated( -mPoly.boundingRect().left(), -mPoly.boundingRect().top() );
306-
p.drawConvexPolygon( t );
311+
312+
// drawPolygon causes issues on windows - corners of path may be missing resulting in triangles being drawn
313+
// instead of rectangles! (Same cause as #13343)
314+
QPainterPath path;
315+
path.addPolygon( t );
316+
p.drawPath( path );
317+
307318
p.end();
308319
}
309320

0 commit comments

Comments
 (0)