19 #include <QFontMetricsF>
53 QList<QPair<double, double> > segmentInfo;
56 double currentLabelNumber = 0.0;
59 int segmentCounter = 0;
60 QString currentNumericLabel;
62 QList<QPair<double, double> >::const_iterator segmentIt = segmentInfo.constBegin();
63 for ( ; segmentIt != segmentInfo.constEnd(); ++segmentIt )
65 if ( segmentCounter == 0 && nSegmentsLeft > 0 )
68 currentNumericLabel = firstLabel;
70 else if ( segmentCounter != 0 && segmentCounter == nSegmentsLeft )
72 currentLabelNumber = 0;
75 if ( segmentCounter >= nSegmentsLeft )
80 if ( segmentCounter == 0 || segmentCounter >= nSegmentsLeft )
85 if ( segmentCounter >= nSegmentsLeft )
93 if ( !segmentInfo.isEmpty() )
115 QString largestNumberLabel = QString::number( largestLabelNumber );
119 double totalBarLength = 0.0;
121 QList< QPair<double, double> > segmentList;
124 QList< QPair<double, double> >::const_iterator segmentIt = segmentList.constBegin();
125 for ( ; segmentIt != segmentList.constEnd(); ++segmentIt )
127 totalBarLength += segmentIt->second;
133 return QRectF(
mScaleBar->transform().dx(),
mScaleBar->transform().dy(), width, height );