Class: QgsLayoutItemMapItem¶
- class qgis.core.QgsLayoutItemMapItem(name: str, map: QgsLayoutItemMap)¶
Bases:
QgsLayoutObject
Constructor for
QgsLayoutItemMapItem
, attached to the specifiedmap
.The
name
argument gives a friendly display name for the item.An item which is drawn inside a
QgsLayoutItemMap
, e.g., a grid or map overview.Methods
Accepts the specified style entity
visitor
, causing it to visit all style entities associated with the map item.- rtype
QgsExpressionContext
Draws the item on to a destination
painter
.Returns whether the item will be drawn.
Called after all pending items have been restored from XML.
Returns the unique id for the map item.
Returns the layout item map for the item.
Returns the internal map layer used by this item, if available.
Returns the friendly display name for the item.
Sets object properties from a DOM element
Sets the map item state from a DOM document, where
element
is the DOM node corresponding to a ‘LayoutMapGrid’ tag.Controls whether the item will be drawn.
Sets the corresponding layout
map
for the item.Sets the friendly display
name
for the item.Sets the item’s stacking
layer
, which specifies where the in the map’s stack the item should be rendered.Sets the item’s stacking
position
, which specifies where the in the map’s stack the item should be rendered.Returns the item’s stacking layer, which specifies where the in the map’s stack the item should be rendered.
Returns the item’s stacking position, which specifies where the in the map’s stack the item should be rendered.
Returns
True
if the item is drawn using advanced effects, such as blend modes.Stores object properties within an XML DOM element.
Stores map item state in a DOM element, where
element
is the DOM element corresponding to a ‘LayoutMap’ tag.Attributes
- StackAboveMapLabels = 4¶
- StackAboveMapLayer = 2¶
- StackBelowMap = 0¶
- StackBelowMapLabels = 3¶
- StackBelowMapLayer = 1¶
- class StackingPosition¶
Bases:
int
- accept(self, visitor: QgsStyleEntityVisitorInterface) → bool¶
Accepts the specified style entity
visitor
, causing it to visit all style entities associated with the map item.Returns
True
if the visitor should continue visiting other objects, orFalse
if visiting should be canceled.New in version 3.10.
- Parameters
visitor (QgsStyleEntityVisitorInterface) –
- Return type
bool
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- createExpressionContext(self) → QgsExpressionContext¶
- Return type
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- draw(self, painter: QPainter)¶
Draws the item on to a destination
painter
.- Parameters
painter (QPainter) –
- enabled(self) → bool¶
Returns whether the item will be drawn.
See also
- Return type
bool
- finalizeRestoreFromXml(self)¶
Called after all pending items have been restored from XML. Map items can use this method to run steps which must take place after all items have been restored to the layout, such as connecting to signals emitted by other items, which may not have existed in the layout at the time
readXml()
was called. E.g. an overview can use this to connect to its linked map item after restoration from XML.See also
- id(self) → str¶
Returns the unique id for the map item.
- Return type
str
- isSignalConnected(self, QMetaMethod) → bool¶
- map(self) → QgsLayoutItemMap¶
Returns the layout item map for the item.
See also
- Return type
- mapLayer(self) → QgsMapLayer¶
Returns the internal map layer used by this item, if available.
New in version 3.10.1.
- Return type
- name(self) → str¶
Returns the friendly display name for the item.
See also
- Return type
str
- readObjectPropertiesFromElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool¶
Sets object properties from a DOM element
- Parameters
parentElement – is the parent DOM element for the object
document – DOM document
context – read write context
- Returns
True
if read was successful
See also
- readXml(self, element: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool¶
Sets the map item state from a DOM document, where
element
is the DOM node corresponding to a ‘LayoutMapGrid’ tag.See also
- Parameters
element (QDomElement) –
doc (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
bool
- receivers(self, PYQT_SIGNAL) → int¶
- sender(self) → QObject¶
- senderSignalIndex(self) → int¶
- setEnabled(self, enabled: bool)¶
Controls whether the item will be drawn. Set
enabled
toTrue
to enable drawing of the item.See also
- Parameters
enabled (bool) –
- setMap(self, map: QgsLayoutItemMap)¶
Sets the corresponding layout
map
for the item.See also
- Parameters
map (QgsLayoutItemMap) –
- setName(self, name: str)¶
Sets the friendly display
name
for the item.See also
- Parameters
name (str) –
- setStackingLayer(self, layer: QgsMapLayer)¶
Sets the item’s stacking
layer
, which specifies where the in the map’s stack the item should be rendered.This setting is only used when
stackingPosition()
is StackBelowMapLayer or StackAboveMapLayer.See also
See also
New in version 3.6.
- Parameters
layer (QgsMapLayer) –
- setStackingPosition(self, position: QgsLayoutItemMapItem.StackingPosition)¶
Sets the item’s stacking
position
, which specifies where the in the map’s stack the item should be rendered.See also
See also
New in version 3.6.
- Parameters
position (QgsLayoutItemMapItem.StackingPosition) –
- stackingLayer(self) → QgsMapLayer¶
Returns the item’s stacking layer, which specifies where the in the map’s stack the item should be rendered.
This setting is only used when
stackingPosition()
is StackBelowMapLayer or StackAboveMapLayer.See also
See also
New in version 3.6.
- Return type
- stackingPosition(self) → QgsLayoutItemMapItem.StackingPosition¶
Returns the item’s stacking position, which specifies where the in the map’s stack the item should be rendered.
See also
See also
New in version 3.6.
- Return type
- timerEvent(self, QTimerEvent)¶
- usesAdvancedEffects(self) → bool¶
Returns
True
if the item is drawn using advanced effects, such as blend modes.- Return type
bool
- writeObjectPropertiesToElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool¶
Stores object properties within an XML DOM element.
- Parameters
parentElement – is the parent DOM element to store the object’s properties in
document – DOM document
context – read write context
- Returns
True
if write was successful
See also
- writeXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) → bool¶
Stores map item state in a DOM element, where
element
is the DOM element corresponding to a ‘LayoutMap’ tag.See also
- Parameters
element (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
bool