16 #ifndef QGSCOMPOSERSCALEBAR_H 17 #define QGSCOMPOSERSCALEBAR_H 58 void paint( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
override;
62 void setNumSegments(
int nSegments );
65 void setNumSegmentsLeft(
int nSegmentsLeft );
68 void setNumUnitsPerSegment(
double units );
77 void setFont(
const QFont& font );
98 QPen
pen()
const {
return mPen;}
105 void setPen(
const QPen& pen ) {mPen = pen;}
113 QBrush
brush()
const {
return mBrush;}
121 void setBrush(
const QBrush& brush ) {mBrush = brush;}
137 void setBrush2(
const QBrush& brush ) {mBrush2 = brush;}
149 void setBoxContentSpace(
double space );
174 void setLineJoinStyle( Qt::PenJoinStyle style );
188 void setLineCapStyle( Qt::PenCapStyle style );
191 void applyDefaultSettings();
197 void setStyle(
const QString& styleName );
200 QString style()
const;
206 void segmentPositions( QList<QPair<double, double> >& posWidthList )
const;
209 void adjustBoxSize();
215 QString firstLabelString()
const;
221 bool writeXML( QDomElement& elem, QDomDocument & doc )
const override;
227 bool readXML(
const QDomElement& itemElem,
const QDomDocument& doc )
override;
230 void correctXPositionAlignment(
double width,
double widthAfter );
236 void updateSegmentSize();
238 void invalidateCurrentMap();
286 void refreshSegmentMillimeters();
289 double mapWidth()
const;
292 #endif //QGSCOMPOSERSCALEBAR_H A scale bar item that can be added to a map composition.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
double mLabelBarSpace
Space between bar and Text labels.
double mHeight
Height of bars/lines.
double mNumUnitsPerSegment
Size of a segment (in map units)
double mNumMapUnitsPerScaleBarUnit
Number of map units per scale bar units (e.g.
void setPen(const QPen &pen)
Sets the pen used for drawing the scalebar.
double boxContentSpace() const
Qt::PenJoinStyle mLineJoinStyle
void setUnitLabeling(const QString &label)
A item that forms part of a map composition.
Alignment alignment() const
Left / Middle/ Right.
ScaleBarUnits units() const
QgsScaleBarStyle * mStyle
Scalebar style.
QBrush mBrush2
Secondary fill.
void setNumMapUnitsPerScaleBarUnit(double d)
double numMapUnitsPerScaleBarUnit() const
double mSegmentMillimeters
Width of a segment (in mm)
int numSegmentsLeft() const
Qt::PenCapStyle mLineCapStyle
double labelBarSpace() const
void setBrush2(const QBrush &brush)
Sets secondary brush for the scalebar.
QString unitLabeling() const
double segmentMillimeters() const
int mNumSegmentsLeft
Number of segments on left side.
Abstraction of composer scale bar style.
const QgsComposerMap * composerMap() const
void setLabelBarSpace(double space)
Graphics scene for map printing.
Object representing map window.
QPen pen() const
Returns the pen used for drawing the scalebar.
QColor fontColor() const
Returns the color used for drawing text in the scalebar.
Qt::PenCapStyle lineCapStyle() const
Returns the cap style used for drawing lines in the scalebar.
int mNumSegments
Number of segments on right side.
void setFontColor(const QColor &c)
Sets the color used for drawing text in the scalebar.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
double numUnitsPerSegment() const
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
double mBoxContentSpace
Space between content and item box.
QString mUnitLabeling
Labeling of map units.
QBrush brush() const
Returns the primary brush for the scalebar.
QBrush brush2() const
Returns the secondary brush for the scalebar.
const QgsComposerMap * mComposerMap
Reference to composer map object.
Qt::PenJoinStyle lineJoinStyle() const
Returns the join style used for drawing lines in the scalebar.
void setBrush(const QBrush &brush)
Sets primary brush for the scalebar.
virtual int type() const override
return correct graphics item type.