Skip to content
Permalink
Browse files

Avoid drawing clipped section labels

  • Loading branch information
nyalldawson committed Jan 6, 2018
1 parent 1ef87a4 commit 392d3777134dbe335b646aa026174a728b882b70
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/gui/layout/qgslayoutreportsectionlabel.cpp
@@ -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 );

0 comments on commit 392d377

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