29 QgsNumericScaleBarStyle::QgsNumericScaleBarStyle():
QgsScaleBarStyle( 0 ), mLastScaleBarWidth( 0 )
54 p->setRenderHint( QPainter::Antialiasing,
true );
61 double penWidth =
mScaleBar->QgsComposerItem::pen().widthF() / 2.0;
64 Qt::AlignmentFlag hAlign;
68 hAlign = Qt::AlignLeft;
71 hAlign = Qt::AlignHCenter;
74 hAlign = Qt::AlignRight;
77 hAlign = Qt::AlignLeft;
82 QRectF painterRect( penWidth + margin, penWidth + margin,
mScaleBar->rect().width() - 2 * penWidth - 2 * margin,
mScaleBar->rect().
height() - 2 * penWidth - 2 * margin );
103 if ( mLastScaleBarWidth != rect.width() && mLastScaleBarWidth > 0 && rect.width() > 0 )
108 mLastScaleBarWidth = rect.width();
112 QString QgsNumericScaleBarStyle::scaleText()
const
114 QString scaleBarText;
118 double scaleDenominator = 1;
122 scaleDenominator = composerMap->
scale();
123 scaleBarText =
"1:" + QString(
"%L1" ).arg( scaleDenominator, 0,
'f', 0 );
125 scaleBarText =
"1:" + QString(
"%L1" ).arg( scaleDenominator, 0,
'f', 0 );