Class: QgsTicksScaleBarRenderer

class qgis.core.QgsTicksScaleBarRenderer

Bases: QgsScaleBarRenderer

Constructor for QgsTicksScaleBarRenderer.

QgsTicksScaleBarRenderer(QgsTicksScaleBarRenderer)

A scale bar that draws segments using short ticks.

Methods

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.

name

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.

tickPosition

Returns the position for tick marks in the scalebar.

Attributes

TicksDown

TicksMiddle

TicksUp

class TickPosition

Bases: int

TicksDown = 1
TicksMiddle = 2
TicksUp = 0
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.

name(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.

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) –

tickPosition(self) → QgsTicksScaleBarRenderer.TickPosition

Returns the position for tick marks in the scalebar.

Return type

QgsTicksScaleBarRenderer.TickPosition