Skip to content

Commit

Permalink
[composer] Only consider frame width if a frame is set when drawing l…
Browse files Browse the repository at this point in the history
…abel text
  • Loading branch information
nyalldawson committed Jun 7, 2014
1 parent 456adad commit 0787294
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/composer/qgscomposerlabel.cpp
Expand Up @@ -78,7 +78,7 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
drawBackground( painter );
painter->save();

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

QString textToDraw = displayText();
Expand Down Expand Up @@ -256,8 +256,10 @@ void QgsComposerLabel::adjustSizeToText()
double textWidth = textWidthMillimeters( mFont, displayText() );
double fontHeight = fontHeightMillimeters( mFont );

double width = textWidth + 2 * mMargin + 2 * pen().widthF() + 1;
double height = fontHeight + 2 * mMargin + 2 * pen().widthF();
double penWidth = hasFrame() ? pen().widthF() : 0;

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

//keep alignment point constant
double xShift = 0;
Expand Down

0 comments on commit 0787294

Please sign in to comment.