Class: QgsLayoutItemMapItem

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

Bases: 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.

Parameters
  • name (str) –

  • map

childEvent()
connectNotify()
customEvent()
disconnectNotify()
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

setEnabled()

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

readXml()

id(self) → str

Returns the unique id for the map item.

Return type

str

isSignalConnected()
map(self) → QgsLayoutItemMap

Returns the layout item map for the item.

See also

setMap()

Return type

QgsLayoutItemMap

name(self) → str

Returns the friendly display name for the item.

See also

setName()

Return type

str

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

Parameters
Return type

bool

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

Parameters

enabled (bool) –

setMap(self, map: QgsLayoutItemMap)

Sets the corresponding layout map for the item.

See also

map()

Parameters

map (QgsLayoutItemMap) –

setName(self, name: str)

Sets the friendly display name for the item.

See also

name()

Parameters

name (str) –

timerEvent()
usesAdvancedEffects(self) → bool

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

Return type

bool

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

Parameters
Return type

bool