Class: QgsLayoutModel¶
A model for items attached to a layout.
The model also maintains the z-order for the layout, and must be notified whenever item stacking changes.
Internally, QgsLayoutModel
maintains two lists. One contains
a complete list of all items for the layout, ordered by their position
within the z-order stack.
The second list contains only items which are currently displayed in the layout’s scene. It is used as a cache of the last known stacking order, so that the model can compare the current stacking of items in the layout to the last known state, and emit the corresponding signals as required.
Class Hierarchy¶
Base classes¶
Methods
Returns the QModelIndex corresponding to a |
|
Returns the |
Attributes
- class qgis.core.QgsLayoutModel[source]¶
Bases:
QAbstractItemModel
- __init__(layout: QgsLayout | None, parent: QObject | None = None)
Constructor for a QgsLayoutModel attached to the specified
layout
.- Parameters:
layout (Optional[QgsLayout])
parent (Optional[QObject] = None)
- class Columns¶
Bases:
int
- ItemId = 2¶
- LockStatus = 1¶
- Visibility = 0¶
- indexForItem(self, item: QgsLayoutItem | None, column: int = 0) QModelIndex [source]¶
Returns the QModelIndex corresponding to a
QgsLayoutItem
item
andcolumn
, if possible.See also
- Parameters:
item (Optional[QgsLayoutItem])
column (int = 0)
- Return type:
QModelIndex
- itemFromIndex(self, index: QModelIndex) QgsLayoutItem | None [source]¶
Returns the
QgsLayoutItem
corresponding to a QModelIndexindex
, if possible.See also
- Parameters:
index (QModelIndex)
- Return type:
Optional[QgsLayoutItem]