Class: QgsScaleBarSettings

class qgis.core.QgsScaleBarSettings

Bases: sip.wrapper

Constructor for QgsScaleBarSettings.

QgsScaleBarSettings(QgsScaleBarSettings)

The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with QgsScaleBarRenderer.

New in version 3.0: Enums

Methods

alignment Returns the scalebar alignment.
boxContentSpace Returns the spacing (margin) between the scalebar box and content in millimeters.
brush Returns the primary brush used for filling the scalebar.
brush2 Returns the secondary brush for the scalebar.
fillColor Returns the color used for fills in the scalebar.
fillColor2 Returns the secondary color used for fills in the scalebar.
font Returns the font used for drawing text in the scalebar.
fontColor Returns the color used for drawing text in the scalebar.
height Returns the scalebar height (in millimeters).
labelBarSpace Returns the spacing (in millimeters) between labels and the scalebar.
lineCapStyle Returns the cap style used for drawing lines in the scalebar.
lineColor Returns the color used for lines in the scalebar.
lineJoinStyle Returns the join style used for drawing lines in the scalebar.
lineWidth Returns the line width in millimeters for lines in the scalebar.
mapUnitsPerScaleBarUnit Returns the number of map units per scale bar unit used by the scalebar.
maximumBarWidth Returns the maximum width (in millimeters) for scale bar segments.
minimumBarWidth Returns the minimum width (in millimeters) for scale bar segments.
numberOfSegments Returns the number of segments included in the scalebar.
numberOfSegmentsLeft Returns the number of segments included in the left part of the scalebar.
pen Returns the pen used for drawing outlines in the scalebar.
segmentSizeMode Returns the size mode for the scale bar segments.
setAlignment Sets the scalebar alignment.
setBoxContentSpace Sets the space (margin) between the scalebar box and content in millimeters.
setBrush Sets the primary brush used for filling the scalebar.
setBrush2 Sets the secondary brush used for filling the scalebar.
setFillColor Sets the color used for fills in the scalebar.
setFillColor2 Sets the secondary color used for fills in the scalebar.
setFont Sets the font used for drawing text in the scalebar.
setFontColor Sets the color used for drawing text in the scalebar.
setHeight Sets the scalebar height (in millimeters).
setLabelBarSpace Sets the spacing (in millimeters) between labels and the scalebar.
setLineCapStyle Sets the cap style used when drawing the lines in the scalebar.
setLineColor Sets the color used for lines in the scalebar.
setLineJoinStyle Sets the join style used when drawing the lines in the scalebar
setLineWidth Sets the line width in millimeters for lines in the scalebar.
setMapUnitsPerScaleBarUnit Sets the number of map units per scale bar unit used by the scalebar.
setMaximumBarWidth Sets the maximum width (in millimeters) for scale bar segments.
setMinimumBarWidth Sets the minimum width (in millimeters) for scale bar segments.
setNumberOfSegments Sets the number of segments included in the scalebar.
setNumberOfSegmentsLeft Sets the number of segments included in the left part of the scalebar.
setPen Sets the pen used for drawing outlines in the scalebar.
setSegmentSizeMode Sets the size mode for scale bar segments.
setTextFormat Sets the text format used for drawing text in the scalebar.
setUnitLabel Sets the label for units.
setUnits Sets the distance units used by the scalebar.
setUnitsPerSegment Sets the number of scalebar units per segment.
textFormat Returns the text format used for drawing text in the scalebar.
unitLabel Returns the label for units.
units Returns the distance units used by the scalebar.
unitsPerSegment Returns the number of scalebar units per segment.

Signals

Attributes

AlignLeft
AlignMiddle
AlignRight
SegmentSizeFitWidth
SegmentSizeFixed
AlignLeft = 0
AlignMiddle = 1
AlignRight = 2
class Alignment

Bases: int

SegmentSizeFitWidth = 1
SegmentSizeFixed = 0
class SegmentSizeMode

Bases: int

alignment(self) → QgsScaleBarSettings.Alignment

Returns the scalebar alignment.

See also

setAlignment()

boxContentSpace(self) → float

Returns the spacing (margin) between the scalebar box and content in millimeters.

brush(self) → QBrush

Returns the primary brush used for filling the scalebar.

See also

setBrush()

See also

brush2()

See also

pen()

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

setBrush2()

See also

brush()

fillColor(self) → QColor

Returns the color used for fills in the scalebar.

See also

setFillColor()

See also

fillColor2()

fillColor2(self) → QColor

Returns the secondary color used for fills in the scalebar.

See also

setFillColor2()

See also

fillColor()

font(self) → QFont

Returns the font used for drawing text in the scalebar.

See also

setFont()

Deprecated since version use: textFormat() instead

fontColor(self) → QColor

Returns the color used for drawing text in the scalebar.

See also

setFontColor()

See also

font()

Deprecated since version use: textFormat() instead

height(self) → float

Returns the scalebar height (in millimeters).

See also

setHeight()

labelBarSpace(self) → float

Returns the spacing (in millimeters) between labels and the scalebar.

lineCapStyle(self) → Qt.PenCapStyle

Returns the cap style used for drawing lines in the scalebar.

lineColor(self) → QColor

Returns the color used for lines in the scalebar.

See also

setLineColor()

lineJoinStyle(self) → Qt.PenJoinStyle

Returns the join style used for drawing lines in the scalebar.

lineWidth(self) → float

Returns the line width in millimeters for lines in the scalebar.

See also

setLineWidth()

mapUnitsPerScaleBarUnit(self) → float

Returns the number of map units per scale bar unit used by the scalebar.

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.

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.

numberOfSegments(self) → int

Returns the number of segments included in the scalebar.

numberOfSegmentsLeft(self) → int

Returns the number of segments included in the left part of the scalebar.

pen(self) → QPen

Returns the pen used for drawing outlines in the scalebar.

See also

setPen()

See also

brush()

segmentSizeMode(self) → QgsScaleBarSettings.SegmentSizeMode

Returns the size mode for the scale bar segments.

setAlignment(self, alignment: QgsScaleBarSettings.Alignment)

Sets the scalebar alignment.

See also

alignment()

setBoxContentSpace(self, space: float)

Sets the space (margin) between the scalebar box and content in millimeters.

setBrush(self, brush: Union[QBrush, QColor, Qt.GlobalColor, QGradient])

Sets the primary brush used for filling the scalebar.

See also

brush()

setBrush2(self, brush: Union[QBrush, QColor, Qt.GlobalColor, QGradient])

Sets the secondary brush used for filling the scalebar.

See also

brush()

setFillColor(self, color: Union[QColor, Qt.GlobalColor])

Sets the color used for fills in the scalebar.

See also

fillColor()

See also

setFillColor2()

setFillColor2(self, color: Union[QColor, Qt.GlobalColor])

Sets the secondary color used for fills in the scalebar.

See also

fillColor2()

See also

setFillColor2()

setFont(self, font: QFont)

Sets the font used for drawing text in the scalebar.

See also

font()

Deprecated since version use: setTextFormat() instead

setFontColor(self, color: Union[QColor, Qt.GlobalColor])

Sets the color used for drawing text in the scalebar.

See also

fontColor()

See also

setFont()

Deprecated since version use: textFormat() instead

setHeight(self, height: float)

Sets the scalebar height (in millimeters).

See also

height()

setLabelBarSpace(self, space: float)

Sets the spacing (in millimeters) between labels and the scalebar.

See also

labelBarSpace()

setLineCapStyle(self, style: Qt.PenCapStyle)

Sets the cap style used when drawing the lines in the scalebar.

See also

lineCapStyle()

setLineColor(self, color: Union[QColor, Qt.GlobalColor])

Sets the color used for lines in the scalebar.

See also

lineColor()

setLineJoinStyle(self, style: Qt.PenJoinStyle)

Sets the join style used when drawing the lines in the scalebar

See also

lineJoinStyle()

setLineWidth(self, width: float)

Sets the line width in millimeters for lines in the scalebar.

See also

lineWidth()

setMapUnitsPerScaleBarUnit(self, units: float)

Sets the number of map units per scale bar unit used by the scalebar.

setMaximumBarWidth(self, width: float)

Sets the maximum width (in millimeters) for scale bar segments. This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.

setMinimumBarWidth(self, width: float)

Sets the minimum width (in millimeters) for scale bar segments. This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.

setNumberOfSegments(self, segments: int)

Sets the number of segments included in the scalebar.

setNumberOfSegmentsLeft(self, segments: int)

Sets the number of segments included in the left part of the scalebar.

setPen(self, pen: Union[QPen, QColor, Qt.GlobalColor])

Sets the pen used for drawing outlines in the scalebar.

See also

pen()

setSegmentSizeMode(self, mode: QgsScaleBarSettings.SegmentSizeMode)

Sets the size mode for scale bar segments.

setTextFormat(self, format: QgsTextFormat)

Sets the text format used for drawing text in the scalebar.

See also

textFormat()

New in version 3.2.

setUnitLabel(self, label: str)

Sets the label for units.

See also

unitLabel()

setUnits(self, units: QgsUnitTypes.DistanceUnit)

Sets the distance units used by the scalebar.

See also

units()

setUnitsPerSegment(self, units: float)

Sets the number of scalebar units per segment.

textFormat(self) → QgsTextFormat

Returns the text format used for drawing text in the scalebar.

See also

setTextFormat()

New in version 3.2.

unitLabel(self) → str

Returns the label for units.

See also

setUnitLabel()

units(self) → QgsUnitTypes.DistanceUnit

Returns the distance units used by the scalebar.

See also

setUnits()

unitsPerSegment(self) → float

Returns the number of scalebar units per segment.