Subgroup: Layout

Class: QgsLayoutItemMapItemStack

class qgis.core.QgsLayoutItemMapItemStack

Bases: sip.wrapper

A collection of map items which are drawn above the map content in a QgsLayoutItemMap. The item stack controls which items are drawn and the order they are drawn in.

New in version 3.0.

See also

QgsLayoutItemMapItem

Methods

addItem Adds a new map item to the stack and takes ownership of the item.
asList Returns a list of QgsLayoutItemMapItems contained by the stack.
containsAdvancedEffects Returns whether any items within the stack contain advanced effects, such as blending modes.
drawItems Draws the items from the stack on a specified painter.
item Returns a reference to an item which matching itemId within the stack.
moveItemDown Moves an item which matching itemId up the stack, causing it to be rendered above other items.
moveItemUp Moves an item which matching itemId up the stack, causing it to be rendered above other items.
readXml Sets the item stack’s state from a DOM document, where element is a DOM node corresponding to a ‘LayoutMap’ tag.
removeItem Removes an item which matching itemId from the stack and deletes the corresponding QgsLayoutItemMapItem
removeItems Clears the item stack and deletes all QgsLayoutItemMapItems contained
size Returns the number of items in the stack.
writeXml Stores the state of the item stack in a DOM node, where element is the DOM element corresponding to a ‘LayoutMap’ tag.

Attributes

addItem(self, item: QgsLayoutItemMapItem)

Adds a new map item to the stack and takes ownership of the item. The item will be added to the end of the stack, and rendered above any existing map items already present in the stack.

Note

After adding an item to the stack update() should be called for the QgsLayoutItemMap to prevent rendering artifacts.

See also

removeItem()

asList(self) → object

Returns a list of QgsLayoutItemMapItems contained by the stack.

containsAdvancedEffects(self) → bool

Returns whether any items within the stack contain advanced effects, such as blending modes.

drawItems(self, painter: QPainter)

Draws the items from the stack on a specified painter.

item(self, itemId: str) → QgsLayoutItemMapItem

Returns a reference to an item which matching itemId within the stack.

See also

constItem()

item(self, index: int) -> QgsLayoutItemMapItem Returns a reference to the item at the specified index within the stack.

See also

constItem()

moveItemDown(self, itemId: str)

Moves an item which matching itemId up the stack, causing it to be rendered above other items.

Note

After moving an item within the stack, update() should be called for the QgsLayoutItemMap to redraw the map with the new item stack order.

See also

moveItemUp()

moveItemUp(self, itemId: str)

Moves an item which matching itemId up the stack, causing it to be rendered above other items.

Note

After moving an item within the stack, update() should be called for the QgsLayoutItemMap to redraw the map with the new item stack order.

See also

moveItemDown()

readXml(self, element: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool

Sets the item stack’s state from a DOM document, where element is a DOM node corresponding to a ‘LayoutMap’ tag. Returns true if read was successful.

See also

writeXml()

removeItem(self, itemId: str)

Removes an item which matching itemId from the stack and deletes the corresponding QgsLayoutItemMapItem

Note

After removing an item from the stack, update() should be called for the QgsLayoutItemMap to prevent rendering artifacts.

See also

addItem()

removeItems(self)

Clears the item stack and deletes all QgsLayoutItemMapItems contained by the stack

size(self) → int

Returns the number of items in the stack.

writeXml(self, element: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool

Stores the state of the item stack in a DOM node, where element is the DOM element corresponding to a ‘LayoutMap’ tag. Returns true if write was successful.

See also

readXml()