Skip to content
Permalink
Browse files

[composer] Fix incorrect calculation of frame thickness for labels

Previously entire frame width was considered when calculating
the margin for the label item. Only half the frame width should be
used, since half is drawn outside the item rect.
  • Loading branch information
nyalldawson committed Oct 14, 2014
1 parent b94b44a commit f284f6e115dbdcb8bbff25db3e1fb6a9da8cb9eb
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/composer/qgscomposerlabel.cpp
@@ -92,7 +92,7 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
//antialiasing on
painter->setRenderHint( QPainter::Antialiasing, true );

double penWidth = hasFrame() ? pen().widthF() : 0;
double penWidth = hasFrame() ? ( pen().widthF() / 2.0 ) : 0;
QRectF painterRect( penWidth + mMargin, penWidth + mMargin, rect().width() - 2 * penWidth - 2 * mMargin, rect().height() - 2 * penWidth - 2 * mMargin );

QString textToDraw = displayText();
@@ -286,7 +286,7 @@ void QgsComposerLabel::adjustSizeToText()
double textWidth = QgsComposerUtils::textWidthMM( mFont, displayText() );
double fontHeight = QgsComposerUtils::fontHeightMM( mFont );

double penWidth = hasFrame() ? pen().widthF() : 0;
double penWidth = hasFrame() ? ( pen().widthF() / 2.0 ) : 0;

double width = textWidth + 2 * mMargin + 2 * penWidth + 1;
double height = fontHeight + 2 * mMargin + 2 * penWidth;

0 comments on commit f284f6e

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