Class: QgsLayoutItemMapItem

class qgis.core.QgsLayoutItemMapItem(name: str, map: QgsLayoutItemMap)

Bases: qgis._core.QgsLayoutObject

Constructor for QgsLayoutItemMapItem, attached to the specified map.

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.

New in version 3.0: Enums

Methods

childEvent

connectNotify

customEvent

disconnectNotify

draw

Draws the item on to a destination painter.

enabled

Returns whether the item will be drawn.

finalizeRestoreFromXml

Called after all pending items have been restored from XML.

id

Returns the unique id for the map item.

isSignalConnected

map

Returns the layout item map for the item.

name

Returns the friendly display name for the item.

readObjectPropertiesFromElement

readXml

Sets the map item state from a DOM document, where element is the DOM node corresponding to a ‘LayoutMapGrid’ tag.

receivers

sender

senderSignalIndex

setEnabled

Controls whether the item will be drawn.

setMap

Sets the corresponding layout map for the item.

setName

Sets the friendly display name for the item.

setStackingLayer

Sets the item’s stacking layer, which specifies where the in the map’s stack the item should be rendered.

setStackingPosition

Sets the item’s stacking position, which specifies where the in the map’s stack the item should be rendered.

stackingLayer

Returns the item’s stacking layer, which specifies where the in the map’s stack the item should be rendered.

stackingPosition

Returns the item’s stacking position, which specifies where the in the map’s stack the item should be rendered.

timerEvent

usesAdvancedEffects

Returns True if the item is drawn using advanced effects, such as blend modes.

writeObjectPropertiesToElement

writeXml

Stores map item state in a DOM element, where element is the DOM element corresponding to a ‘LayoutMap’ tag.

Signals

Attributes

StackAboveMapLabels

StackAboveMapLayer

StackBelowMap

StackBelowMapLabels

StackBelowMapLayer

StackAboveMapLabels = 4
StackAboveMapLayer = 2
StackBelowMap = 0
StackBelowMapLabels = 3
StackBelowMapLayer = 1
class StackingPosition

Bases: int

childEvent()
connectNotify()
customEvent()
disconnectNotify()
draw(self, painter: QPainter)

Draws the item on to a destination painter.

enabled(self) → bool

Returns whether the item will be drawn.

See also

setEnabled()

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

readXml()

id(self) → str

Returns the unique id for the map item.

isSignalConnected()
map(self) → QgsLayoutItemMap

Returns the layout item map for the item.

See also

setMap()

name(self) → str

Returns the friendly display name for the item.

See also

setName()

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

writeXml()

receivers()
sender()
senderSignalIndex()
setEnabled(self, enabled: bool)

Controls whether the item will be drawn. Set enabled to True to enable drawing of the item.

See also

enabled()

setMap(self, map: QgsLayoutItemMap)

Sets the corresponding layout map for the item.

See also

map()

setName(self, name: str)

Sets the friendly display name for the item.

See also

name()

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

stackingLayer()

New in version 3.6.

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.

New in version 3.6.

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.

New in version 3.6.

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

stackingLayer()

New in version 3.6.

timerEvent()
usesAdvancedEffects(self) → bool

Returns True if the item is drawn using advanced effects, such as blend modes.

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

readXml()