Subgroup: Layout
Class: QgsLayoutItemScaleBar¶
-
class
qgis.core.
QgsLayoutItemScaleBar
(layout: QgsLayout)¶ Bases:
qgis._core.QgsLayoutItem
Constructor for QgsLayoutItemScaleBar, with the specified parent
layout
.A layout item subclass for scale bars.
New in version 3.0: Methods
adjustPointForReferencePosition
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
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. childEvent
connectNotify
contextMenuEvent
create
Returns a new scale bar item for the specified layout
.customEvent
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
draw
drawBackground
drawDebugRect
drawFrame
dropEvent
fillColor
Returns the color used for fills in the scalebar. fillColor2
Returns the secondary color used for fills in the scalebar. finalizeRestoreFromXml
focusInEvent
focusOutEvent
font
Returns the font used for drawing text in the scalebar. fontColor
Returns the color used for drawing text in the scalebar. guessUnits
Attempts to guess the most reasonable unit choice for the scalebar, given the current linked map’s scale. height
Returns the scalebar height (in millimeters). hoverEnterEvent
hoverLeaveEvent
hoverMoveEvent
icon
inputMethodEvent
inputMethodQuery
isSignalConnected
itemChange
keyPressEvent
keyReleaseEvent
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. linkedMap
Returns the map item linked to 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. minimumSize
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
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. positionAtReferencePoint
prepareGeometryChange
readObjectPropertiesFromElement
readPropertiesFromElement
receivers
refreshBackgroundColor
refreshBlendMode
refreshDataDefinedProperty
refreshFrame
refreshItemPosition
refreshItemRotation
refreshItemSize
refreshOpacity
resizeToMinimumWidth
Resizes the scale bar to its minimum width, without changing the height. sceneEvent
sceneEventFilter
segmentSizeMode
Returns the size mode for the scale bar segments. sender
senderSignalIndex
setAlignment
Sets the scalebar alignment
.setBoxContentSpace
Sets the space
(margin) between the scalebar box and content in millimeters.setFillColor
Sets the color
used for fills in the scalebar.setFillColor2
Sets the secondary color
used for fills in the scalebar.setFixedSize
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 scalebarsetLineWidth
Sets the line width
in millimeters for lines in the scalebar.setLinkedMap
Sets the map
item linked to 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.setMinimumSize
setNumberOfSegments
Sets the number of segments
included in the scalebar.setNumberOfSegmentsLeft
Sets the number of segments
included in the left part of the scalebar.setSegmentSizeMode
Sets the size mode
for scale bar segments.setStyle
Sets the scale bar style by name
.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.style
Returns the scale bar style name. textFormat
Returns the text format used for drawing text in the scalebar. timerEvent
topLeftToReferencePoint
type
unitLabel
Returns the label for units. units
Returns the distance units used by the scalebar. unitsPerSegment
Returns the number of scalebar units per segment. update
Adjusts the scale bar box size and updates the item. updateMicroFocus
wheelEvent
writeObjectPropertiesToElement
writePropertiesToElement
Signals
Attributes
-
adjustPointForReferencePosition
()¶
-
alignment
(self) → QgsScaleBarSettings.Alignment¶ Returns the scalebar alignment.
See also
-
applyDataDefinedSize
()¶
-
applyDefaultSettings
(self)¶ Applies the default scalebar settings to the scale bar.
See also
-
applyDefaultSize
(self, units: QgsUnitTypes.DistanceUnit = QgsUnitTypes.DistanceMeters)¶ Applies the default size to the scale bar (scale bar 1/5 of map item width)
See also
-
applyItemSizeConstraint
()¶
-
boxContentSpace
(self) → float¶ Returns the spacing (margin) between the scalebar box and content in millimeters.
See also
-
brush
(self) → QBrush¶ Returns the primary brush for the scalebar.
Returns: QBrush used for filling the scalebar See also
See also
-
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
-
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: QgsLayoutItemRenderContext)¶
-
drawBackground
()¶
-
drawDebugRect
()¶
-
drawFrame
()¶
-
dropEvent
()¶
-
fillColor
(self) → QColor¶ Returns the color used for fills in the scalebar.
See also
See also
-
fillColor2
(self) → QColor¶ Returns the secondary color used for fills in the scalebar.
See also
See also
-
finalizeRestoreFromXml
(self)¶
-
focusInEvent
()¶
-
focusOutEvent
()¶
-
font
(self) → QFont¶ Returns the font used for drawing text in the scalebar.
See also
Deprecated since version use: textFormat() instead
-
fontColor
(self) → QColor¶ Returns the color used for drawing text in the scalebar.
See also
See also
Deprecated since version use: textFormat() instead
-
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
-
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.
See also
-
lineCapStyle
(self) → Qt.PenCapStyle¶ Returns the cap style used for drawing lines in the scalebar.
See also
-
lineColor
(self) → QColor¶ Returns the color used for lines in the scalebar.
See also
-
lineJoinStyle
(self) → Qt.PenJoinStyle¶ Returns the join style used for drawing lines in the scalebar.
See also
-
lineWidth
(self) → float¶ Returns the line width in millimeters for lines in the scalebar.
See also
-
linkedMap
(self) → QgsLayoutItemMap¶ Returns the map item linked to the scalebar.
See also
-
mapUnitsPerScaleBarUnit
(self) → float¶ Returns the number of map units per scale bar unit used by the scalebar.
See also
-
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.
See also
See also
See also
-
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.
See also
See also
See also
-
minimumSize
(self) → QgsLayoutSize¶
-
mouseDoubleClickEvent
()¶
-
mouseMoveEvent
()¶
-
mousePressEvent
()¶
-
mouseReleaseEvent
()¶
-
numberOfSegments
(self) → int¶ Returns the number of segments included in the scalebar.
See also
See also
-
numberOfSegmentsLeft
(self) → int¶ Returns the number of segments included in the left part of the scalebar.
See also
See also
-
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
See also
See also
-
sender
()¶
-
senderSignalIndex
()¶
-
setAlignment
(self, alignment: QgsScaleBarSettings.Alignment)¶ Sets the scalebar
alignment
.See also
-
setBoxContentSpace
(self, space: float)¶ Sets the
space
(margin) between the scalebar box and content in millimeters.See also
-
setFillColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the
color
used for fills in the scalebar.See also
See also
-
setFillColor2
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the secondary
color
used for fills in the scalebar.See also
See also
-
setFixedSize
()¶
-
setFont
(self, font: QFont)¶ Sets the
font
used for drawing text in the scalebar.See also
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
See also
Deprecated since version use: setTextFormat() instead
-
setLabelBarSpace
(self, space: float)¶ Sets the spacing (in millimeters) between labels and the scalebar.
See also
-
setLineCapStyle
(self, style: Qt.PenCapStyle)¶ Sets the cap
style
used when drawing the lines in the scalebar.See also
-
setLineColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Sets the
color
used for lines in the scalebar.See also
-
setLineJoinStyle
(self, style: Qt.PenJoinStyle)¶ Sets the join
style
used when drawing the lines in the scalebarSee also
-
setLineWidth
(self, width: float)¶ Sets the line
width
in millimeters for lines in the scalebar.See also
-
setLinkedMap
(self, map: QgsLayoutItemMap)¶ Sets the
map
item linked to the scalebar.See also
-
setMapUnitsPerScaleBarUnit
(self, units: float)¶ Sets the number of map
units
per scale bar unit used by the scalebar.See also
-
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.See also
See also
See also
-
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.See also
See also
See also
-
setMinimumSize
()¶
-
setNumberOfSegments
(self, segments: int)¶ Sets the number of
segments
included in the scalebar.See also
See also
-
setNumberOfSegmentsLeft
(self, segments: int)¶ Sets the number of
segments
included in the left part of the scalebar.See also
See also
-
setSegmentSizeMode
(self, mode: QgsScaleBarSettings.SegmentSizeMode)¶ Sets the size
mode
for scale bar segments.See also
See also
See also
-
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
-
setTextFormat
(self, format: QgsTextFormat)¶ Sets the text
format
used for drawing text in the scalebar.See also
New in version 3.2.
-
setUnitLabel
(self, label: str)¶ Sets the
label
for units.See also
-
setUnits
(self, units: QgsUnitTypes.DistanceUnit)¶ Sets the distance
units
used by the scalebar.See also
-
setUnitsPerSegment
(self, units: float)¶ Sets the number of scalebar
units
per segment.See also
-
style
(self) → str¶ Returns the scale bar style name.
See also
-
textFormat
(self) → QgsTextFormat¶ Returns the text format used for drawing text in the scalebar.
See also
New in version 3.2.
-
timerEvent
()¶
-
topLeftToReferencePoint
()¶
-
type
(self) → int¶
-
unitLabel
(self) → str¶ Returns the label for units.
See also
-
units
(self) → QgsUnitTypes.DistanceUnit¶ Returns the distance units used by the scalebar.
See also
-
unitsPerSegment
(self) → float¶ Returns the number of scalebar units per segment.
See also
-
update
(self)¶ Adjusts the scale bar box size and updates the item.
-
updateMicroFocus
()¶
-
wheelEvent
()¶
-
writeObjectPropertiesToElement
()¶
-
writePropertiesToElement
(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool¶
-