54 p->setRenderHint( QPainter::Antialiasing,
true );
57 QList<QPair<double, double> > segmentInfo;
62 QList<QPair<double, double> >::const_iterator segmentIt = segmentInfo.constBegin();
63 for ( ; segmentIt != segmentInfo.constEnd(); ++segmentIt )
75 QRectF segmentRectTop( segmentIt->first + xOffset, barTopPosition, segmentIt->second, segmentHeight );
76 p->drawRect( segmentRectTop );
89 QRectF segmentRectBottom( segmentIt->first + xOffset, barTopPosition + segmentHeight, segmentIt->second, segmentHeight );
90 p->drawRect( segmentRectBottom );
A scale bar item that can be added to a map composition.
virtual void drawLabels(QPainter *p) const
double boxContentSpace() const
void segmentPositions(QList< QPair< double, double > > &posWidthList) const
Returns the x - positions of the segment borders (in item coordinates) and the width of the segment...
static double fontAscentMM(const QFont &font)
Calculate font ascent in millimeters, including workarounds for QT font rendering issues...
void draw(QPainter *p, double xOffset=0) const override
Draws the style.
double labelBarSpace() const
QString name() const override
Abstraction of composer scale bar style.
QPen pen() const
Returns the pen used for drawing the scalebar.
const QgsComposerScaleBar * mScaleBar
QgsDoubleBoxScaleBarStyle(const QgsComposerScaleBar *bar)
~QgsDoubleBoxScaleBarStyle()
QBrush brush() const
Returns the primary brush for the scalebar.
QBrush brush2() const
Returns the secondary brush for the scalebar.