Class: QgsLayoutItemGroup

A container for grouping several QgsLayoutItems.

Class Hierarchy

Inheritance diagram of qgis.core.QgsLayoutItemGroup

Base classes

QgsLayoutItem

Base class for graphical items within a QgsLayout.

QgsLayoutObject

A base class for objects which belong to a layout.

QObject

QgsExpressionContextGenerator

Abstract interface for generating an expression context.

QGraphicsRectItem

QAbstractGraphicsShapeItem

QGraphicsItem

QgsLayoutUndoObjectInterface

Interface for layout objects which support undo/redo commands.

Methods

addItem

Adds an item to the group.

items

Returns a list of items contained by the group.

removeItems

Removes all items from the group (but does not delete them).

Static Methods

create

Returns a new group item for the specified layout.

class qgis.core.QgsLayoutItemGroup[source]

Bases: QgsLayoutItem

__init__(layout: QgsLayout | None)

Constructor for QgsLayoutItemGroup, belonging to the specified layout.

Parameters:

layout (Optional[QgsLayout])

addItem(self, item: QgsLayoutItem | None)[source]

Adds an item to the group. Ownership of the item is transferred to the group.

Parameters:

item (Optional[QgsLayoutItem])

static create(layout: QgsLayout | None) QgsLayoutItemGroup | None[source]

Returns a new group item for the specified layout.

The caller takes responsibility for deleting the returned object.

Parameters:

layout (Optional[QgsLayout])

Return type:

Optional[QgsLayoutItemGroup]

items(self) List[QgsLayoutItem]

Returns a list of items contained by the group.

Return type:

List[QgsLayoutItem]

removeItems(self)[source]

Removes all items from the group (but does not delete them). Items remain in the scene but are no longer grouped together