Skip to content

Commit

Permalink
Avoid drawing clipped section labels
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 6, 2018
1 parent 1ef87a4 commit 392d377
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/layout/qgslayoutreportsectionlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ void QgsLayoutReportSectionLabel::paint( QPainter *painter, const QStyleOptionGr
QRectF r = rect();
QRectF scaledRect( r.left() / scaleValue, r.top() / scaleValue, r.width() / scaleValue, r.height() / scaleValue );

if ( scaledRect.width() < s.width() + 2 * margin || scaledRect.height() < s.height() + 2 * margin )
{
// zoomed out too far to fully draw label inside item rect
return;
}

QRectF textRect = QRectF( scaledRect.left() + margin, scaledRect.top() + margin, scaledRect.width() - 2 * margin, scaledRect.height() - 2 * margin );
QRectF boxRect = QRectF( scaledRect.left(), scaledRect.bottom() - ( s.height() + 2 * margin ), s.width() + 2 * margin, s.height() + 2 * margin );

Expand Down

0 comments on commit 392d377

Please sign in to comment.