Class: QgsHollowScaleBarRenderer

class qgis.core.QgsHollowScaleBarRenderer

Bases: QgsScaleBarRenderer

Constructor for QgsHollowScaleBarRenderer.

QgsHollowScaleBarRenderer(QgsHollowScaleBarRenderer)

Scalebar style that draws a single box with alternating color for the segments, with horizontal lines through alternating segments. AKA “South African” style.

Methods

applyDefaultSettings

param settings

clone

rtype

QgsHollowScaleBarRenderer

draw

param context

drawDefaultLabels

Draws default scalebar labels using the specified settings and scaleContext to a destination render context.

firstLabelString

Returns the text used for the first label in the scalebar.

firstLabelXOffset

Returns the x-offset (in millimeters) used for the first label in the scalebar.

flags

rtype

QgsScaleBarRenderer.Flags

id

rtype

str

segmentPositions

Returns a list of positions for each segment within the scalebar.

segmentWidths

Returns a list of widths of each segment of the scalebar.

sortKey

rtype

int

visibleName

rtype

str

applyDefaultSettings(self, settings: QgsScaleBarSettings) → bool
Parameters

settings (QgsScaleBarSettings) –

Return type

bool

clone(self)QgsHollowScaleBarRenderer
Return type

QgsHollowScaleBarRenderer

draw(self, context: QgsRenderContext, settings: QgsScaleBarSettings, scaleContext: QgsScaleBarRenderer.ScaleBarContext)
Parameters
drawDefaultLabels(self, context: QgsRenderContext, settings: QgsScaleBarSettings, scaleContext: QgsScaleBarRenderer.ScaleBarContext)

Draws default scalebar labels using the specified settings and scaleContext to a destination render context.

firstLabelString(self, settings: QgsScaleBarSettings) → str

Returns the text used for the first label in the scalebar.

firstLabelXOffset(self, settings: QgsScaleBarSettings) → float

Returns the x-offset (in millimeters) used for the first label in the scalebar.

Deprecated since version Use: the version with QgsRenderContext instead.

firstLabelXOffset(self, settings: QgsScaleBarSettings, context: QgsRenderContext, scaleContext: QgsScaleBarRenderer.ScaleBarContext) -> float Returns the x-offset (in render context painter units) used for the first label in the scalebar.

New in version 3.2.

flags(self)QgsScaleBarRenderer.Flags
Return type

QgsScaleBarRenderer.Flags

id(self) → str
Return type

str

segmentPositions(self, scaleContext: QgsScaleBarRenderer.ScaleBarContext, settings: QgsScaleBarSettings) → List[float]

Returns a list of positions for each segment within the scalebar.

Deprecated since version use: the version with a QgsRenderContext instead

segmentPositions(self, context: QgsRenderContext, scaleContext: QgsScaleBarRenderer.ScaleBarContext, settings: QgsScaleBarSettings) -> List[float] Returns a list of positions for each segment within the scalebar.

New in version 3.14.

segmentWidths(self, scaleContext: QgsScaleBarRenderer.ScaleBarContext, settings: QgsScaleBarSettings) → List[float]

Returns a list of widths of each segment of the scalebar.

sortKey(self) → int
Return type

int

visibleName(self) → str
Return type

str