Class: QgsTicksScaleBarRenderer

class qgis.core.QgsTicksScaleBarRenderer

Bases: QgsScaleBarRenderer

A scale bar that draws segments using short ticks.

QgsTicksScaleBarRenderer(position: QgsTicksScaleBarRenderer.TickPosition = QgsTicksScaleBarRenderer.TicksMiddle) Constructor for QgsTicksScaleBarRenderer.

QgsTicksScaleBarRenderer(a0: QgsTicksScaleBarRenderer)

Methods

clone

rtype:

Optional[QgsTicksScaleBarRenderer]

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.

setTickPosition

Sets the position for tick marks in the scalebar.

sortKey

rtype:

int

tickPosition

Returns the position for tick marks in the scalebar.

visibleName

rtype:

str

Attributes

TicksDown

TicksMiddle

TicksUp

class TickPosition

Bases: int

TicksDown = 1
TicksMiddle = 2
TicksUp = 0
clone(self) QgsTicksScaleBarRenderer | None
Return type:

Optional[QgsTicksScaleBarRenderer]

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.

Added 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.

Added in version 3.14.

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

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

setTickPosition(self, position: QgsTicksScaleBarRenderer.TickPosition)

Sets the position for tick marks in the scalebar.

See also

tickPosition()

Parameters:

position (QgsTicksScaleBarRenderer.TickPosition)

sortKey(self) int
Return type:

int

tickPosition(self) QgsTicksScaleBarRenderer.TickPosition

Returns the position for tick marks in the scalebar.

Return type:

QgsTicksScaleBarRenderer.TickPosition

visibleName(self) str
Return type:

str