Class: QgsScaleBarSettings¶
- class qgis.core.QgsScaleBarSettings¶
Bases:
sip.wrapper
The
QgsScaleBarSettings
class stores the appearance and layout settings for scalebar drawing withQgsScaleBarRenderer
.New in version 3.0.
QgsScaleBarSettings() Constructor for QgsScaleBarSettings.
QgsScaleBarSettings(other:
QgsScaleBarSettings
) Copy constructorMethods
Returns the scalebar alignment.
Returns the secondary fill symbol used to render the scalebar (only used for some scalebar types).
Returns the spacing (margin) between the scalebar box and content in millimeters.
Returns the primary brush used for filling the scalebar.
Returns the secondary brush for the scalebar.
Returns the line symbol used to render the scalebar divisions (only used for some scalebar types).
Returns the color used for fills in the scalebar.
Returns the secondary color used for fills in the scalebar.
Returns the primary fill symbol used to render the scalebar (only used for some scalebar types).
Returns the font used for drawing text in the scalebar.
Returns the color used for drawing text in the scalebar.
Returns the scalebar height (in millimeters).
Returns the spacing (in millimeters) between labels and the scalebar.
Returns the horizontal placement of text labels.
Returns the vertical placement of text labels.
Returns the cap style used for drawing lines in the scalebar.
Returns the color used for lines in the scalebar.
Returns the join style used for drawing lines in the scalebar.
Returns the line symbol used to render the scalebar (only used for some scalebar types).
Returns the line width in millimeters for lines in the scalebar.
Returns the number of map units per scale bar unit used by the scalebar.
Returns the maximum width (in millimeters) for scale bar segments.
Returns the minimum width (in millimeters) for scale bar segments.
Returns the number of segments included in the scalebar.
Returns the number of segments included in the left part of the scalebar.
Returns the number of subdivisions for segments included in the right part of the scalebar (only used for some scalebar types).
Returns the numeric format used for numbers in the scalebar.
Returns the pen used for drawing outlines in the scalebar.
Returns the size mode for the scale bar segments.
Sets the scalebar
alignment
.Sets the secondary fill
symbol
used to render the scalebar (only used for some scalebar types).Sets the
space
(margin) between the scalebar box and content in millimeters.Sets the primary brush used for filling the scalebar.
Sets the secondary brush used for filling the scalebar.
Sets the line
symbol
used to render the scalebar divisions (only used for some scalebar types).Sets the
color
used for fills in the scalebar.Sets the secondary
color
used for fills in the scalebar.Sets the primary fill
symbol
used to render the scalebar (only used for some scalebar types).Sets the
font
used for drawing text in the scalebar.Sets the
color
used for drawing text in the scalebar.Sets the scalebar
height
(in millimeters).Sets the spacing (in millimeters) between labels and the scalebar.
Sets the horizontal
placement
of text labels.Sets the vertical
placement
of text labels.Sets the cap
style
used when drawing the lines in the scalebar.Sets the
color
used for lines in the scalebar.Sets the join
style
used when drawing the lines in the scalebarSets the line
symbol
used to render the scalebar (only used for some scalebar types).Sets the line
width
in millimeters for lines in the scalebar.Sets the number of map
units
per scale bar unit used by the scalebar.Sets the maximum
width
(in millimeters) for scale bar segments.Sets the minimum
width
(in millimeters) for scale bar segments.Sets the number of
segments
included in the scalebar.Sets the number of
segments
included in the left part of the scalebar.Sets the number of
subdivisions
for segments included in the right part of the scalebar (only used for some scalebar types).Sets the numeric
format
used for numbers in the scalebar.Sets the pen used for drawing outlines in the scalebar.
Sets the size
mode
for scale bar segments.Sets the line
symbol
used to render the scalebar subdivisions (only used for some scalebar types).Sets the scalebar subdivisions
height
(in millimeters) for segments included in the right part of the scalebar (only used for some scalebar types).Sets the text
format
used for drawing text in the scalebar.Sets the
label
for units.Sets the distance
units
used by the scalebar.Sets the number of scalebar
units
per segment.Returns the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Returns the scalebar subdivisions height (in millimeters) for segments included in the right part of the scalebar (only used for some scalebar types).
Returns the text format used for drawing text in the scalebar.
Returns the label for units.
Returns the distance units used by the scalebar.
Returns the number of scalebar units per segment.
Attributes
- AlignLeft = 0¶
- AlignMiddle = 1¶
- AlignRight = 2¶
- class Alignment¶
Bases:
int
- LabelAboveSegment = 0¶
- LabelBelowSegment = 1¶
- LabelCenteredEdge = 0¶
- LabelCenteredSegment = 1¶
- class LabelHorizontalPlacement¶
Bases:
int
- class LabelVerticalPlacement¶
Bases:
int
- SegmentSizeFitWidth = 1¶
- SegmentSizeFixed = 0¶
- class SegmentSizeMode¶
Bases:
int
- alignment(self) QgsScaleBarSettings.Alignment ¶
Returns the scalebar alignment.
See also
- Return type
- alternateFillSymbol(self) QgsFillSymbol ¶
Returns the secondary fill symbol used to render the scalebar (only used for some scalebar types).
Ownership is not transferred.
See also
See also
New in version 3.14.
- Return type
- boxContentSpace(self) float ¶
Returns the spacing (margin) between the scalebar box and content in millimeters.
See also
- Return type
float
- brush(self) QBrush ¶
Returns the primary brush used for filling the scalebar.
See also
See also
See also
Deprecated since version use:
fillSymbol()
instead- Return type
QBrush
- brush2(self) QBrush ¶
Returns the secondary brush for the scalebar. This is used for alternating color style scalebars, such as single and double box styles.
See also
See also
Deprecated since version use:
alternateFillSymbol()
instead- Return type
QBrush
- divisionLineSymbol(self) QgsLineSymbol ¶
Returns the line symbol used to render the scalebar divisions (only used for some scalebar types).
Ownership is not transferred.
See also
See also
See also
New in version 3.14.
- Return type
- fillColor(self) QColor ¶
Returns the color used for fills in the scalebar.
See also
See also
Deprecated since version use:
fillSymbol()
instead.- Return type
QColor
- fillColor2(self) QColor ¶
Returns the secondary color used for fills in the scalebar.
See also
See also
Deprecated since version use:
alternateFillSymbol()
instead- Return type
QColor
- fillSymbol(self) QgsFillSymbol ¶
Returns the primary fill symbol used to render the scalebar (only used for some scalebar types).
Ownership is not transferred.
See also
See also
New in version 3.14.
- Return type
- font(self) QFont ¶
Returns the font used for drawing text in the scalebar.
See also
Deprecated since version use:
textFormat()
instead- Return type
QFont
- fontColor(self) QColor ¶
Returns the color used for drawing text in the scalebar.
See also
See also
Deprecated since version use:
textFormat()
instead- Return type
QColor
- height(self) float ¶
Returns the scalebar height (in millimeters).
See also
- Return type
float
- labelBarSpace(self) float ¶
Returns the spacing (in millimeters) between labels and the scalebar.
See also
- Return type
float
- labelHorizontalPlacement(self) QgsScaleBarSettings.LabelHorizontalPlacement ¶
Returns the horizontal placement of text labels.
See also
New in version 3.10.
- Return type
- labelVerticalPlacement(self) QgsScaleBarSettings.LabelVerticalPlacement ¶
Returns the vertical placement of text labels.
See also
New in version 3.10.
- Return type
- lineCapStyle(self) Qt.PenCapStyle ¶
Returns the cap style used for drawing lines in the scalebar.
See also
Deprecated since version use:
lineSymbol()
instead- Return type
Qt.PenCapStyle
- lineColor(self) QColor ¶
Returns the color used for lines in the scalebar.
See also
Deprecated since version use:
lineSymbol()
instead.- Return type
QColor
- lineJoinStyle(self) Qt.PenJoinStyle ¶
Returns the join style used for drawing lines in the scalebar.
See also
Deprecated since version use:
lineSymbol()
instead- Return type
Qt.PenJoinStyle
- lineSymbol(self) QgsLineSymbol ¶
Returns the line symbol used to render the scalebar (only used for some scalebar types).
Ownership is not transferred.
See also
See also
See also
New in version 3.14.
- Return type
- lineWidth(self) float ¶
Returns the line width in millimeters for lines in the scalebar.
See also
Deprecated since version use:
lineSymbol()
instead.- Return type
float
- mapUnitsPerScaleBarUnit(self) float ¶
Returns the number of map units per scale bar unit used by the scalebar.
See also
- Return type
float
- maximumBarWidth(self) float ¶
Returns the maximum width (in millimeters) for scale bar segments. This property is only effective if the
segmentSizeMode()
is set to SegmentSizeFitWidth.See also
See also
See also
- Return type
float
- minimumBarWidth(self) float ¶
Returns the minimum width (in millimeters) for scale bar segments. This property is only effective if the
segmentSizeMode()
is set to SegmentSizeFitWidth.See also
See also
See also
- Return type
float
- numberOfSegments(self) int ¶
Returns the number of segments included in the scalebar.
See also
See also
- Return type
int
- numberOfSegmentsLeft(self) int ¶
Returns the number of segments included in the left part of the scalebar.
See also
See also
- Return type
int
- numberOfSubdivisions(self) int ¶
Returns the number of subdivisions for segments included in the right part of the scalebar (only used for some scalebar types).
Note
The number of subdivisions represents the number of subdivision segments, not the number of subdivision lines. E.g. if the number is 1 then NO subdivision lines will be shown.
See also
New in version 3.14.
- Return type
int
- numericFormat(self) QgsNumericFormat ¶
Returns the numeric format used for numbers in the scalebar.
See also
New in version 3.12.
- Return type
- pen(self) QPen ¶
Returns the pen used for drawing outlines in the scalebar.
See also
See also
Deprecated since version use:
lineSymbol()
instead.- Return type
QPen
- segmentSizeMode(self) QgsScaleBarSettings.SegmentSizeMode ¶
Returns the size mode for the scale bar segments.
See also
See also
See also
- Return type
- setAlignment(self, alignment: QgsScaleBarSettings.Alignment)¶
Sets the scalebar
alignment
.See also
- Parameters
alignment (QgsScaleBarSettings.Alignment) –
- setAlternateFillSymbol(self, symbol: QgsFillSymbol)¶
Sets the secondary fill
symbol
used to render the scalebar (only used for some scalebar types). Ownership ofsymbol
is transferred to the scalebar.See also
See also
New in version 3.14.
- Parameters
symbol (QgsFillSymbol) –
- setBoxContentSpace(self, space: float)¶
Sets the
space
(margin) between the scalebar box and content in millimeters.See also
- Parameters
space (float) –
- setBrush(self, brush: Union[QBrush, QColor, Qt.GlobalColor, QGradient])¶
Sets the primary brush used for filling the scalebar.
See also
Deprecated since version use:
setFillSymbol()
instead- Parameters
brush (Union[QBrush) –
- setBrush2(self, brush: Union[QBrush, QColor, Qt.GlobalColor, QGradient])¶
Sets the secondary brush used for filling the scalebar.
See also
Deprecated since version use:
setAlternateFillSymbol()
instead- Parameters
brush (Union[QBrush) –
- setDivisionLineSymbol(self, symbol: QgsLineSymbol)¶
Sets the line
symbol
used to render the scalebar divisions (only used for some scalebar types). Ownership ofsymbol
is transferred to the scalebar.See also
See also
See also
New in version 3.14.
- Parameters
symbol (QgsLineSymbol) –
- setFillColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])¶
Sets the
color
used for fills in the scalebar.See also
See also
Deprecated since version use:
setFillSymbol()
instead.- Parameters
color (Union[QColor) –
- setFillColor2(self, color: Union[QColor, Qt.GlobalColor, QGradient])¶
Sets the secondary
color
used for fills in the scalebar.See also
See also
Deprecated since version use:
setAlternateFillSymbol()
instead.- Parameters
color (Union[QColor) –
- setFillSymbol(self, symbol: QgsFillSymbol)¶
Sets the primary fill
symbol
used to render the scalebar (only used for some scalebar types). Ownership ofsymbol
is transferred to the scalebar.See also
See also
New in version 3.14.
- Parameters
symbol (QgsFillSymbol) –
- setFont(self, font: QFont)¶
Sets the
font
used for drawing text in the scalebar.See also
Deprecated since version use:
setTextFormat()
instead- Parameters
font (QFont) –
- setFontColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])¶
Sets the
color
used for drawing text in the scalebar.See also
See also
Deprecated since version use:
textFormat()
instead- Parameters
color (Union[QColor) –
- setHeight(self, height: float)¶
Sets the scalebar
height
(in millimeters).See also
- Parameters
height (float) –
- setLabelBarSpace(self, space: float)¶
Sets the spacing (in millimeters) between labels and the scalebar.
See also
- Parameters
space (float) –
- setLabelHorizontalPlacement(self, placement: QgsScaleBarSettings.LabelHorizontalPlacement)¶
Sets the horizontal
placement
of text labels.See also
New in version 3.10.
- Parameters
placement (QgsScaleBarSettings.LabelHorizontalPlacement) –
- setLabelVerticalPlacement(self, placement: QgsScaleBarSettings.LabelVerticalPlacement)¶
Sets the vertical
placement
of text labels.See also
New in version 3.10.
- Parameters
placement (QgsScaleBarSettings.LabelVerticalPlacement) –
- setLineCapStyle(self, style: Qt.PenCapStyle)¶
Sets the cap
style
used when drawing the lines in the scalebar.See also
Deprecated since version use:
setLineSymbol()
instead- Parameters
style (Qt.PenCapStyle) –
- setLineColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])¶
Sets the
color
used for lines in the scalebar.See also
Deprecated since version use:
setLineSymbol()
instead.- Parameters
color (Union[QColor) –
- setLineJoinStyle(self, style: Qt.PenJoinStyle)¶
Sets the join
style
used when drawing the lines in the scalebarSee also
Deprecated since version use:
setLineSymbol()
instead- Parameters
style (Qt.PenJoinStyle) –
- setLineSymbol(self, symbol: QgsLineSymbol)¶
Sets the line
symbol
used to render the scalebar (only used for some scalebar types). Ownership ofsymbol
is transferred to the scalebar.See also
See also
See also
New in version 3.14.
- Parameters
symbol (QgsLineSymbol) –
- setLineWidth(self, width: float)¶
Sets the line
width
in millimeters for lines in the scalebar.See also
Deprecated since version use:
setLineSymbol()
instead.- Parameters
width (float) –
- setMapUnitsPerScaleBarUnit(self, units: float)¶
Sets the number of map
units
per scale bar unit used by the scalebar.See also
- Parameters
units (float) –
- setMaximumBarWidth(self, width: float)¶
Sets the maximum
width
(in millimeters) for scale bar segments. This property is only effective if thesegmentSizeMode()
is set to SegmentSizeFitWidth.See also
See also
See also
- Parameters
width (float) –
- setMinimumBarWidth(self, width: float)¶
Sets the minimum
width
(in millimeters) for scale bar segments. This property is only effective if thesegmentSizeMode()
is set to SegmentSizeFitWidth.See also
See also
See also
- Parameters
width (float) –
- setNumberOfSegments(self, segments: int)¶
Sets the number of
segments
included in the scalebar.See also
See also
- Parameters
segments (int) –
- setNumberOfSegmentsLeft(self, segments: int)¶
Sets the number of
segments
included in the left part of the scalebar.See also
See also
- Parameters
segments (int) –
- setNumberOfSubdivisions(self, subdivisions: int)¶
Sets the number of
subdivisions
for segments included in the right part of the scalebar (only used for some scalebar types).Note
The number of subdivisions represents the number of subdivision segments, not the number of subdivision lines. E.g. if the number is 1 then NO subdivision lines will be shown.
See also
New in version 3.14.
- Parameters
subdivisions (int) –
- setNumericFormat(self, format: QgsNumericFormat)¶
Sets the numeric
format
used for numbers in the scalebar.Ownership of
format
is transferred to the settings.See also
New in version 3.12.
- Parameters
format (QgsNumericFormat) –
- setPen(self, pen: Union[QPen, QColor, Qt.GlobalColor, QGradient])¶
Sets the pen used for drawing outlines in the scalebar.
See also
Deprecated since version use:
setLineSymbol()
instead.- Parameters
pen (Union[QPen) –
- setSegmentSizeMode(self, mode: QgsScaleBarSettings.SegmentSizeMode)¶
Sets the size
mode
for scale bar segments.See also
See also
See also
- Parameters
mode (QgsScaleBarSettings.SegmentSizeMode) –
- setSubdivisionLineSymbol(self, symbol: QgsLineSymbol)¶
Sets the line
symbol
used to render the scalebar subdivisions (only used for some scalebar types). Ownership ofsymbol
is transferred to the scalebar.See also
See also
See also
New in version 3.14.
- Parameters
symbol (QgsLineSymbol) –
- setSubdivisionsHeight(self, height: float)¶
Sets the scalebar subdivisions
height
(in millimeters) for segments included in the right part of the scalebar (only used for some scalebar types).See also
New in version 3.14.
- Parameters
height (float) –
- setTextFormat(self, format: QgsTextFormat)¶
Sets the text
format
used for drawing text in the scalebar.See also
New in version 3.2.
- Parameters
format (QgsTextFormat) –
- setUnitLabel(self, label: str)¶
Sets the
label
for units.See also
- Parameters
label (str) –
- setUnits(self, units: QgsUnitTypes.DistanceUnit)¶
Sets the distance
units
used by the scalebar.See also
- Parameters
units (QgsUnitTypes.DistanceUnit) –
- setUnitsPerSegment(self, units: float)¶
Sets the number of scalebar
units
per segment.See also
- Parameters
units (float) –
- subdivisionLineSymbol(self) QgsLineSymbol ¶
Returns the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Ownership is not transferred.
See also
See also
See also
New in version 3.14.
- Return type
- subdivisionsHeight(self) float ¶
Returns the scalebar subdivisions height (in millimeters) for segments included in the right part of the scalebar (only used for some scalebar types).
See also
New in version 3.14.
- Return type
float
- textFormat(self) QgsTextFormat ¶
Returns the text format used for drawing text in the scalebar.
See also
New in version 3.2.
- Return type
- unitLabel(self) str ¶
Returns the label for units.
See also
- Return type
str
- units(self) QgsUnitTypes.DistanceUnit ¶
Returns the distance units used by the scalebar.
See also
- Return type
- unitsPerSegment(self) float ¶
Returns the number of scalebar units per segment.
See also
- Return type
float