Skip to content

Commit f284f6e

Browse files
committed
[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.
1 parent b94b44a commit f284f6e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/composer/qgscomposerlabel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
9292
//antialiasing on
9393
painter->setRenderHint( QPainter::Antialiasing, true );
9494

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

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

289-
double penWidth = hasFrame() ? pen().widthF() : 0;
289+
double penWidth = hasFrame() ? ( pen().widthF() / 2.0 ) : 0;
290290

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

0 commit comments

Comments
 (0)