Subgroup: Layout

Class: QgsLayoutItemScaleBar

class qgis.core.QgsLayoutItemScaleBar

Bases: qgis._core.QgsLayoutItem

A layout item subclass for scale bars.

New in version 3.0: Methods

acceptDrops
acceptHoverEvents
acceptTouchEvents
acceptedMouseButtons
adjustPointForReferencePosition
advance
alignment Returns the scalebar alignment.
applyDataDefinedSize
applyDefaultSettings Applies the default scalebar settings to the scale bar.
applyDefaultSize Applies the default size to the scale bar (scale bar 1/5 of map item width)
applyItemSizeConstraint
attemptMove Attempts to move the item to a specified point.
attemptMoveBy Attempts to shift the item’s position by a specified deltaX and deltaY, in layout units.
attemptResize Attempts to resize the item to a specified target size.
attemptSetSceneRect Attempts to update the item’s position and size to match the passed rect in layout coordinates.
backgroundColor Returns the background color for this item.
beginCommand Starts new undo command for this item.
blendMode Returns the item’s composition blending mode.
blockSignals
boundingRect
boundingRegion
boundingRegionGranularity
boxContentSpace Returns the spacing (margin) between the scalebar box and content in millimeters.
brush Returns the primary brush for the scalebar.
brush2 Returns the secondary brush for the scalebar.
cacheMode
cancelCommand Cancels the current item command and discards it.
childEvent
childItems
children
childrenBoundingRect
cleanup Called just before a batch of items are deleted, allowing them to run cleanup tasks.
clearFocus
clipPath
collidesWithItem
collidesWithPath
collidingItems
commonAncestorItem
connectNotify
contains
containsAdvancedEffects Returns true if the item contains contents with blend modes or transparency effects which can only be reproduced by rastering the item.
contextMenuEvent
create Returns a new scale bar item for the specified layout.
createCommand
createExpressionContext
cursor
customEvent
customProperties Return list of keys stored in custom properties for the object.
customProperty Read a custom property from the object.
data
dataDefinedProperties Returns a reference to the object’s property collection, used for data defined overrides.
deleteLater
deviceTransform
disconnect
disconnectNotify
displayName Get item display name.
dragEnterEvent
dragLeaveEvent
dragMoveEvent
draw
drawBackground
drawDebugRect
drawFrame
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
effectiveOpacity
endCommand Completes the current item command and push it onto the layout’s undo stack.
ensureVisible ensureVisible(self, float, float, float, float, xMargin: int = 50, yMargin: int = 50)
estimatedFrameBleed Returns the estimated amount the item’s frame bleeds outside the item’s actual rectangle.
event
eventFilter
excludeFromExports Returns whether the item should be excluded from layout exports and prints.
fillColor Returns the color used for fills in the scalebar.
fillColor2 Returns the secondary color used for fills in the scalebar.
filtersChildEvents
finalizeRestoreFromXml
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
fixedSize Returns the fixed size of the item, if applicable, or an empty size if item can be freely resized.
flags
focusInEvent
focusItem
focusOutEvent
focusProxy
font Returns the font used for drawing text in the scalebar.
fontColor Returns the color used for drawing text in the scalebar.
frameEnabled Returns true if the item includes a frame.
frameJoinStyle Returns the join style used for drawing the item’s frame.
frameStrokeColor Returns the frame’s stroke color.
frameStrokeWidth Returns the frame’s stroke width.
grabKeyboard
grabMouse
graphicsEffect
group
guessUnits Attempts to guess the most reasonable unit choice for the scalebar, given the current linked map’s scale.
hasBackground Returns true if the item has a background.
hasCursor
hasFocus
height Returns the scalebar height (in millimeters).
hide
hoverEnterEvent
hoverLeaveEvent
hoverMoveEvent
icon
id Returns the item’s ID name.
inherits
inputMethodEvent
inputMethodHints
inputMethodQuery
installEventFilter
installSceneEventFilter
invalidateCache Forces a deferred update of any cached image the item uses.
isActive
isAncestorOf
isBlockedByModalPanel
isClipped
isEnabled
isGroupMember Returns true if the item is part of a QgsLayoutItemGroup group.
isLocked Returns true if the item is locked, and cannot be interacted with using the mouse.
isObscured isObscured(self, float, float, float, float) -> bool
isObscuredBy
isPanel
isSelected
isSignalConnected
isUnderMouse
isVisible
isVisibleTo
isWidget
isWidgetType
isWindow
isWindowType
itemChange
itemOpacity Returns the item’s opacity.
itemRotation Returns the current rotation for the item, in degrees clockwise.
itemTransform
keyPressEvent
keyReleaseEvent
killTimer
labelBarSpace Returns the spacing (in millimeters) between labels and the scalebar.
layout Returns the layout the object is attached to.
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.
linkedMap Returns the map item linked to the scalebar.
mapFromItem mapFromItem(self, QGraphicsItem, QRectF) -> QPolygonF
mapFromParent mapFromParent(self, QRectF) -> QPolygonF
mapFromScene mapFromScene(self, QRectF) -> QPolygonF
mapRectFromItem mapRectFromItem(self, QGraphicsItem, float, float, float, float) -> QRectF
mapRectFromParent mapRectFromParent(self, float, float, float, float) -> QRectF
mapRectFromScene mapRectFromScene(self, float, float, float, float) -> QRectF
mapRectToItem mapRectToItem(self, QGraphicsItem, float, float, float, float) -> QRectF
mapRectToParent mapRectToParent(self, float, float, float, float) -> QRectF
mapRectToScene mapRectToScene(self, float, float, float, float) -> QRectF
mapToItem mapToItem(self, QGraphicsItem, QRectF) -> QPolygonF
mapToParent mapToParent(self, QRectF) -> QPolygonF
mapToScene mapToScene(self, QRectF) -> QPolygonF
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.
metaObject
minimumBarWidth Returns the minimum width (in millimeters) for scale bar segments.
minimumSize
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveBy
moveContent Moves the content of the item, by a specified dx and dy in layout units.
moveToThread
numberExportLayers Returns the number of layers that this item requires for exporting during layered exports (e.g.
numberOfSegments Returns the number of segments included in the scalebar.
numberOfSegmentsLeft Returns the number of segments included in the left part of the scalebar.
objectName
opacity
opaqueArea
page Returns the page the item is currently on, with the first page returning 0.
pagePos Returns the item’s position (in layout units) relative to the top left corner of its current page.
pagePositionWithUnits Returns the item’s position (in item units) relative to the top left corner of its current page.
paint Handles preparing a paint surface for the layout item and painting the item’s content.
panel
panelModality
parent
parentGroup Returns the item’s parent group, if the item is part of a QgsLayoutItemGroup group.
parentItem
parentObject
parentWidget
pen Returns the pen used for drawing outlines in the scalebar.
pos
positionAtReferencePoint
positionWithUnits Returns the item’s current position, including units.
prepareGeometryChange
property
propertyDefinitions Returns the layout object property definitions.
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
readObjectPropertiesFromElement
readPropertiesFromElement
readXml Sets the item state from a DOM element.
receivers
rect
rectWithFrame Returns the item’s rectangular bounds, including any bleed caused by the item’s frame.
redraw Triggers a redraw (update) of the item.
referencePoint Returns the reference point for positioning of the layout item.
refresh Refreshes the item, causing a recalculation of any property overrides and recalculation of its position and size.
refreshBackgroundColor
refreshBlendMode
refreshDataDefinedProperty
refreshFrame
refreshItemPosition
refreshItemRotation
refreshItemSize
refreshOpacity
removeCustomProperty Remove a custom property from the object.
removeEventFilter
removeSceneEventFilter
requiresRasterization Returns true if the item is drawn in such a way that forces the whole layout to be rasterized when exporting to vector formats.
resetTransform
resizeToMinimumWidth Resizes the scale bar to its minimum width, without changing the height.
rotateItem Rotates the item by a specified angle in degrees clockwise around a specified reference point.
rotation
scale
scene
sceneBoundingRect
sceneEvent
sceneEventFilter
scenePos
sceneTransform
scroll
segmentSizeMode Returns the size mode for the scale bar segments.
sender
senderSignalIndex
setAcceptDrops
setAcceptHoverEvents
setAcceptTouchEvents
setAcceptedMouseButtons
setActive
setAlignment Sets the scalebar alignment.
setBackgroundColor Sets the background color for this item.
setBackgroundEnabled Sets whether this item has a background drawn under it or not.
setBlendMode Sets the item’s composition blending mode.
setBoundingRegionGranularity
setBoxContentSpace Sets the space (margin) between the scalebar box and content in millimeters.
setBrush
setCacheMode
setCursor
setCustomProperty Set a custom property for the object.
setData
setDataDefinedProperties Sets the objects’s property collection, used for data defined overrides.
setEnabled
setExcludeFromExports Sets whether the item should be excluded from layout exports and prints.
setFillColor Sets the color used for fills in the scalebar.
setFillColor2 Sets the secondary color used for fills in the scalebar.
setFiltersChildEvents
setFixedSize
setFlag
setFlags
setFocus
setFocusProxy
setFont Sets the font used for drawing text in the scalebar.
setFontColor Sets the color used for drawing text in the scalebar.
setFrameEnabled Sets whether this item has a frame drawn around it or not.
setFrameJoinStyle Sets the join style used when drawing the item’s frame.
setFrameStrokeColor Sets the frame stroke color.
setFrameStrokeWidth Sets the frame stroke width.
setGraphicsEffect
setGroup
setHeight Sets the scalebar height (in millimeters).
setId Set the item’s id name.
setInputMethodHints
setItemOpacity Sets the item’s opacity.
setItemRotation Sets the layout item’s rotation, in degrees clockwise.
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.
setLinkedMap Sets the map item linked to the scalebar.
setLocked Sets whether the item is locked, preventing mouse interactions with the item.
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.
setMinimumSize
setMoveContentPreviewOffset Sets temporary offset for the item, by a specified dx and dy in layout units.
setNumberOfSegments Sets the number of segments included in the scalebar.
setNumberOfSegmentsLeft Sets the number of segments included in the left part of the scalebar.
setObjectName
setOpacity
setPanelModality
setParent
setParentGroup Sets the item’s parent group.
setParentItem
setPen
setPos setPos(self, float, float)
setProperty
setRect setRect(self, float, float, float, float)
setReferencePoint Sets the reference point for positioning of the layout item.
setRotation
setScale
setSegmentSizeMode Sets the size mode for scale bar segments.
setSelected Sets whether the item should be selected.
setStyle Sets the scale bar style by name.
setToolTip
setTransform
setTransformOriginPoint setTransformOriginPoint(self, float, float)
setTransformations
setUnitLabel Sets the label for units.
setUnits Sets the distance units used by the scalebar.
setUnitsPerSegment Sets the number of scalebar units per segment.
setVisibility Sets whether the item is visible.
setVisible
setX
setY
setZValue
shape
shouldDrawItem Returns whether the item should be drawn in the current context.
show
signalsBlocked
sizeWithUnits Returns the item’s current size, including units.
stackBefore
startTimer
style Returns the scale bar style name.
templateUuid Returns the item’s original identification string.
thread
timerEvent
toGraphicsObject
toolTip
topLeftToReferencePoint
topLevelItem
topLevelWidget
tr
transform
transformOriginPoint
transformations
type
ungrabKeyboard
ungrabMouse
unitLabel Returns the label for units.
units Returns the distance units used by the scalebar.
unitsPerSegment Returns the number of scalebar units per segment.
unsetCursor
update Adjusts the scale bar box size and updates the item.
updateMicroFocus
uuid Returns the item identification string.
wheelEvent
window
writeObjectPropertiesToElement
writePropertiesToElement
writeXml Stores the item state in a DOM element.
x
y
zValue
zoomContent Zooms content of item.

Attributes

AllProperties
BackgroundColor
BlendMode
DeviceCoordinateCache
EvaluatedValue
ExcludeFromExports
FrameColor
ItemAcceptsInputMethod
ItemChildAddedChange
ItemChildRemovedChange
ItemClipsChildrenToShape
ItemClipsToShape
ItemContainsChildrenInShape
ItemCoordinateCache
ItemCursorChange
ItemCursorHasChanged
ItemDoesntPropagateOpacityToChildren
ItemEnabledChange
ItemEnabledHasChanged
ItemFlagsChange
ItemFlagsHaveChanged
ItemHasNoContents
ItemHeight
ItemIgnoresParentOpacity
ItemIgnoresTransformations
ItemIsFocusable
ItemIsMovable
ItemIsPanel
ItemIsSelectable
ItemMatrixChange
ItemNegativeZStacksBehindParent
ItemOpacityChange
ItemOpacityHasChanged
ItemParentChange
ItemParentHasChanged
ItemPositionChange
ItemPositionHasChanged
ItemRotation
ItemRotationChange
ItemRotationHasChanged
ItemScaleChange
ItemScaleHasChanged
ItemSceneChange
ItemSceneHasChanged
ItemScenePositionHasChanged
ItemSelectedChange
ItemSelectedHasChanged
ItemSendsGeometryChanges
ItemSendsScenePositionChanges
ItemStacksBehindParent
ItemToolTipChange
ItemToolTipHasChanged
ItemTransformChange
ItemTransformHasChanged
ItemTransformOriginPointChange
ItemTransformOriginPointHasChanged
ItemUsesExtendedStyleOption
ItemVisibleChange
ItemVisibleHasChanged
ItemWidth
ItemZValueChange
ItemZValueHasChanged
LegendColumnCount
LegendTitle
LowerLeft
LowerMiddle
LowerRight
MapAtlasMargin
MapLayers
MapRotation
MapScale
MapStylePreset
MapXMax
MapXMin
MapYMax
MapYMin
Middle
MiddleLeft
MiddleRight
NoCache
NoProperty
NonModal
NumPages
Opacity
OriginalValue
PageNumber
PanelModal
PaperHeight
PaperOrientation
PaperWidth
PictureSource
PictureSvgBackgroundColor
PictureSvgStrokeColor
PictureSvgStrokeWidth
PositionX
PositionY
PresetPaperSize
ScalebarFillColor
ScalebarFillColor2
ScalebarLineColor
ScalebarLineWidth
SceneModal
SourceUrl
TestProperty
Transparency
Type
UndoArrowHeadFillColor
UndoArrowHeadStrokeColor
UndoArrowHeadWidth
UndoArrowStrokeWidth
UndoAtlasMargin
UndoBackgroundColor
UndoCustomCommand
UndoGridFramePenColor
UndoIncrementalMove
UndoIncrementalResize
UndoLabelFont
UndoLabelFontColor
UndoLabelMargin
UndoLabelText
UndoLegendBoxSpace
UndoLegendColumnCount
UndoLegendColumnSpace
UndoLegendFontColor
UndoLegendGroupFont
UndoLegendGroupSpace
UndoLegendIconSymbolSpace
UndoLegendItemFont
UndoLegendLayerFont
UndoLegendLayerSpace
UndoLegendLineSpacing
UndoLegendRasterStrokeColor
UndoLegendRasterStrokeWidth
UndoLegendSymbolHeight
UndoLegendSymbolSpace
UndoLegendSymbolWidth
UndoLegendText
UndoLegendTitleFont
UndoLegendTitleSpaceBottom
UndoLegendWmsLegendHeight
UndoLegendWmsLegendWidth
UndoMapAnnotationDistance
UndoMapGridAnnotationFontColor
UndoMapGridFrameFill1Color
UndoMapGridFrameFill2Color
UndoMapGridLineSymbol
UndoMapGridMarkerSymbol
UndoMapRotation
UndoNodeMove
UndoNone
UndoOpacity
UndoOverviewStyle
UndoPictureFillColor
UndoPictureNorthOffset
UndoPictureRotation
UndoPictureStrokeColor
UndoPictureStrokeWidth
UndoRotation
UndoScaleBarBoxContentSpace
UndoScaleBarFillColor
UndoScaleBarFillColor2
UndoScaleBarFontColor
UndoScaleBarHeight
UndoScaleBarLabelBarSize
UndoScaleBarLineWidth
UndoScaleBarMapUnitsSegment
UndoScaleBarSegmentSize
UndoScaleBarSegments
UndoScaleBarSegmentsLeft
UndoScaleBarStrokeColor
UndoScaleBarUnitText
UndoSetId
UndoShapeCornerRadius
UndoShapeStyle
UndoStrokeColor
UndoStrokeWidth
UndoZoomContent
UpperLeft
UpperMiddle
UpperRight
UserType
changed Emitted when the object’s properties change.
destroyed destroyed(self, QObject = None) [signal]
frameChanged Emitted if the item’s frame style changes.
lockChanged Emitted if the item’s lock status changes.
objectNameChanged objectNameChanged(self, str) [signal]
rotationChanged Emitted on item rotation change.
sizePositionChanged Emitted when the item’s size or position changes.
staticMetaObject
adjustPointForReferencePosition()
alignment(self) → QgsScaleBarSettings.Alignment

Returns the scalebar alignment.

See also

setAlignment()

applyDataDefinedSize()
applyDefaultSettings(self)

Applies the default scalebar settings to the scale bar.

applyDefaultSize(self, units: QgsUnitTypes.DistanceUnit = QgsUnitTypes.DistanceMeters)

Applies the default size to the scale bar (scale bar 1/5 of map item width)

applyItemSizeConstraint()
boxContentSpace(self) → float

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

brush(self) → QBrush

Returns the primary brush for the scalebar.

Returns:QBrush 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.

Returns:QBrush used for secondary color areas

See also

setBrush2()

See also

brush()

childEvent()
connectNotify()
contextMenuEvent()
create(layout: QgsLayout) → QgsLayoutItemScaleBar

Returns a new scale bar item for the specified layout.

The caller takes responsibility for deleting the returned object.

customEvent()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
draw(self, context: QgsRenderContext, itemStyle: QStyleOptionGraphicsItem = None)
drawBackground()
drawDebugRect()
drawFrame()
dropEvent()
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()

finalizeRestoreFromXml(self)
focusInEvent()
focusOutEvent()
font(self) → QFont

Returns the font used for drawing text in the scalebar.

See also

setFont()

fontColor(self) → QColor

Returns the color used for drawing text in the scalebar.

See also

setFontColor()

See also

font()

guessUnits(self) → QgsUnitTypes.DistanceUnit

Attempts to guess the most reasonable unit choice for the scalebar, given the current linked map’s scale.

This method also considers the linked map’s CRS, in order to determine if metric or imperial units are more appropriate.

height(self) → float

Returns the scalebar height (in millimeters).

See also

setHeight()

hoverEnterEvent()
hoverLeaveEvent()
hoverMoveEvent()
icon(self) → QIcon
inputMethodEvent()
inputMethodQuery()
isSignalConnected()
itemChange()
keyPressEvent()
keyReleaseEvent()
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()

linkedMap(self) → QgsLayoutItemMap

Returns the map item linked to the scalebar.

See also

setLinkedMap()

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.

minimumSize(self) → QgsLayoutSize
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
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()

positionAtReferencePoint()
prepareGeometryChange()
readObjectPropertiesFromElement()
readPropertiesFromElement(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool
receivers()
refreshBackgroundColor()
refreshBlendMode()
refreshDataDefinedProperty(self, property: QgsLayoutObject.DataDefinedProperty = QgsLayoutObject.AllProperties)
refreshFrame()
refreshItemPosition()
refreshItemRotation()
refreshItemSize()
refreshOpacity()
resizeToMinimumWidth(self)

Resizes the scale bar to its minimum width, without changing the height.

sceneEvent()
sceneEventFilter()
segmentSizeMode(self) → QgsScaleBarSettings.SegmentSizeMode

Returns the size mode for the scale bar segments.

See also

minBarWidth()

See also

maxBarWidth()

sender()
senderSignalIndex()
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.

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

setFixedSize()
setFont(self, font: QFont)

Sets the font used for drawing text in the scalebar.

See also

setFont()

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

Sets the color used for drawing text in the scalebar.

See also

fontColor()

See also

setFont()

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

setLinkedMap(self, map: QgsLayoutItemMap)

Sets the map item linked to the scalebar.

See also

linkedMap()

setMapUnitsPerScaleBarUnit(self, units: float)

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

setMaximumBarWidth(self, maxWidth: 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, minWidth: float)

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

setMinimumSize()
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.

setSegmentSizeMode(self, mode: QgsScaleBarSettings.SegmentSizeMode)

Sets the size mode for scale bar segments.

setStyle(self, name: str)

Sets the scale bar style by name.

The name parameter gives the (untranslated) style name. Possibilities are: ‘Single Box’, ‘Double Box’, ‘Line Ticks Middle’, ‘Line Ticks Down’, ‘Line Ticks Up’, ‘Numeric’

See also

style()

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.

style(self) → str

Returns the scale bar style name.

See also

setStyle()

timerEvent()
topLeftToReferencePoint()
type(self) → int
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.

update(self)

Adjusts the scale bar box size and updates the item.

updateMicroFocus()
wheelEvent()
writeObjectPropertiesToElement()
writePropertiesToElement(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool