16 #ifndef QGSLAYOUTITEMSCALEBAR_H 17 #define QGSLAYOUTITEMSCALEBAR_H 19 #include "qgis_core.h" 46 int type()
const override;
47 QIcon
icon()
const override;
69 void setNumberOfSegments(
int segments );
83 void setNumberOfSegmentsLeft(
int segments );
95 void setUnitsPerSegment(
double units );
131 void setMinimumBarWidth(
double minWidth );
151 void setMaximumBarWidth(
double maxWidth );
169 QString
unitLabel()
const {
return mSettings.unitLabel(); }
175 void setUnitLabel(
const QString &label ) { mSettings.setUnitLabel( label );}
203 Q_DECL_DEPRECATED
void setFont(
const QFont &font )
SIP_DEPRECATED;
219 Q_DECL_DEPRECATED
void setFontColor(
const QColor &color )
SIP_DEPRECATED;
226 QColor
fillColor()
const {
return mSettings.fillColor(); }
233 void setFillColor(
const QColor &color ) { mSettings.setFillColor( color ); }
247 void setFillColor2(
const QColor &color ) { mSettings.setFillColor2( color ); }
253 QColor
lineColor()
const {
return mSettings.lineColor(); }
259 void setLineColor(
const QColor &color ) { mSettings.setLineColor( color ); }
265 double lineWidth()
const {
return mSettings.lineWidth(); }
277 QPen
pen()
const {
return mSettings.pen(); }
285 QBrush
brush()
const {
return mSettings.brush();}
293 QBrush
brush2()
const {
return mSettings.brush2(); }
299 double height()
const {
return mSettings.height(); }
305 void setHeight(
double height ) { mSettings.setHeight( height ); }
341 void setBoxContentSpace(
double space );
371 Qt::PenJoinStyle
lineJoinStyle()
const {
return mSettings.lineJoinStyle(); }
377 void setLineJoinStyle( Qt::PenJoinStyle style );
383 Qt::PenCapStyle
lineCapStyle()
const {
return mSettings.lineCapStyle(); }
389 void setLineCapStyle( Qt::PenCapStyle style );
395 void applyDefaultSettings();
415 void resizeToMinimumWidth();
426 void setStyle(
const QString &name );
432 QString style()
const;
449 void disconnectCurrentMap();
460 std::unique_ptr< QgsScaleBarRenderer > mStyle;
463 double mSegmentMillimeters = 0.0;
466 void refreshSegmentMillimeters();
469 double mapWidth()
const;
477 #endif //QGSLAYOUTITEMSCALEBAR_H QColor fillColor() const
Returns the color used for fills in the scalebar.
The class is used as a container of context for various read/write operations on other objects...
double lineWidth() const
Returns the line width in millimeters for lines in the scalebar.
void setLineWidth(double width)
Sets the line width in millimeters for lines in the scalebar.
virtual QIcon icon() const
Returns the item's icon.
QColor fillColor2() const
Returns the secondary color used for fills in the scalebar.
Base class for graphical items within a QgsLayout.
int type() const override
Returns a unique graphics item type identifier.
double minimumBarWidth() const
Returns the minimum width (in millimeters) for scale bar segments.
QString unitLabel() const
Returns the label for units.
double labelBarSpace() const
Returns the spacing (in millimeters) between labels and the scalebar.
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
int numberOfSegments() const
Returns the number of segments included in the scalebar.
Alignment
Scalebar alignment.
void setHeight(double height)
Sets the scalebar height (in millimeters).
virtual QgsLayoutSize minimumSize() const
Returns the minimum allowed size of the item, if applicable, or an empty size if item can be freely r...
void setLineColor(const QColor &color)
Sets the color used for lines in the scalebar.
QBrush brush2() const
Returns the secondary brush for the scalebar.
virtual void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::AllProperties)
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
QBrush brush() const
Returns the primary brush for the scalebar.
void setFillColor(const QColor &color)
Sets the color used for fills in the scalebar.
Layout graphical items for displaying a map.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
void setMapUnitsPerScaleBarUnit(double units)
Sets the number of map units per scale bar unit used by the scalebar.
QgsScaleBarSettings::Alignment alignment() const
Returns the scalebar alignment.
double unitsPerSegment() const
Returns the number of scalebar units per segment.
QgsUnitTypes::DistanceUnit units() const
Returns the distance units used by the scalebar.
QgsLayoutItemMap * linkedMap() const
Returns the map item linked to the scalebar.
void setUnitLabel(const QString &label)
Sets the label for units.
void setFillColor2(const QColor &color)
Sets the secondary color used for fills in the scalebar.
SegmentSizeMode
Modes for setting size for scale bar segments.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Contains settings and helpers relating to a render of a QgsLayoutItem.
DistanceUnit
Units of distance.
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
QPen pen() const
Returns the pen used for drawing outlines in the scalebar.
int numberOfSegmentsLeft() const
Returns the number of segments included in the left part of the scalebar.
double boxContentSpace() const
Returns the spacing (margin) between the scalebar box and content in millimeters. ...
A layout item subclass for scale bars.
QColor lineColor() const
Returns the color used for lines in the scalebar.
Qt::PenCapStyle lineCapStyle() const
Returns the cap style used for drawing lines in the scalebar.
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
Qt::PenJoinStyle lineJoinStyle() const
Returns the join style used for drawing lines in the scalebar.
Container for all settings relating to text rendering.
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
double mapUnitsPerScaleBarUnit() const
Returns the number of map units per scale bar unit used by the scalebar.
double height() const
Returns the scalebar height (in millimeters).
DataDefinedProperty
Data defined properties for different item types.
double maximumBarWidth() const
Returns the maximum width (in millimeters) for scale bar segments.
QgsScaleBarSettings::SegmentSizeMode segmentSizeMode() const
Returns the size mode for the scale bar segments.
The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with Qgs...
void setLabelBarSpace(double space)
Sets the spacing (in millimeters) between labels and the scalebar.
Contains parameters regarding scalebar calculations.