Class: QgsLayoutModel¶
- class qgis.core.QgsLayoutModel¶
Bases:
PyQt5.QtCore.QAbstractItemModel
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.
New in version 3.0.
QgsLayoutModel(layout:
QgsLayout
, parent: QObject = None) Constructor for aQgsLayoutModel
attached to the specifiedlayout
.Methods
- param parent:
- param index:
- param data:
- param index:
- param section:
- param row:
Returns the QModelIndex corresponding to a
QgsLayoutItem
item
andcolumn
, if possible.Returns the
QgsLayoutItem
corresponding to a QModelIndexindex
, if possible.- param indexes:
- rtype:
List[str]
- param index:
- param row:
- param parent:
- param index:
- rtype:
Qt.DropActions
Attributes
- class Columns¶
Bases:
int
- ItemId = 2¶
- LockStatus = 1¶
- Visibility = 0¶
- beginInsertColumns(self, QModelIndex, int, int)¶
- beginInsertRows(self, QModelIndex, int, int)¶
- beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) bool ¶
- beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) bool ¶
- beginRemoveColumns(self, QModelIndex, int, int)¶
- beginRemoveRows(self, QModelIndex, int, int)¶
- beginResetModel(self)¶
- changePersistentIndex(self, QModelIndex, QModelIndex)¶
- changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])¶
- childEvent(self, QChildEvent)¶
- columnCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex()) –
- Return type:
int
- connectNotify(self, QMetaMethod)¶
- createIndex(self, int, int, object: object = 0) QModelIndex ¶
- customEvent(self, QEvent)¶
- data(self, index: QModelIndex, role: int) Any ¶
- Parameters:
index (QModelIndex) –
role (int) –
- Return type:
Any
- decodeData(self, int, int, QModelIndex, QDataStream) bool ¶
- disconnectNotify(self, QMetaMethod)¶
- dropMimeData(self, data: QMimeData, action: Qt.DropAction, row: int, column: int, parent: QModelIndex) bool ¶
- Parameters:
data (QMimeData) –
action (Qt.DropAction) –
row (int) –
column (int) –
parent (QModelIndex) –
- Return type:
bool
- encodeData(self, Iterable[QModelIndex], QDataStream)¶
- endInsertColumns(self)¶
- endInsertRows(self)¶
- endMoveColumns(self)¶
- endMoveRows(self)¶
- endRemoveColumns(self)¶
- endRemoveRows(self)¶
- endResetModel(self)¶
- flags(self, index: QModelIndex) Qt.ItemFlags ¶
- Parameters:
index (QModelIndex) –
- Return type:
Qt.ItemFlags
- headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) Any ¶
- Parameters:
section (int) –
orientation (Qt.Orientation) –
role (int = Qt.DisplayRole) –
- Return type:
Any
- index(self, row: int, column: int, parent: QModelIndex = QModelIndex()) QModelIndex ¶
- Parameters:
row (int) –
column (int) –
parent (QModelIndex = QModelIndex()) –
- Return type:
QModelIndex
- indexForItem(self, item: QgsLayoutItem, column: int = 0) QModelIndex ¶
Returns the QModelIndex corresponding to a
QgsLayoutItem
item
andcolumn
, if possible.See also
- Parameters:
item (QgsLayoutItem) –
column (int = 0) –
- Return type:
QModelIndex
- isSignalConnected(self, QMetaMethod) bool ¶
- itemFromIndex(self, index: QModelIndex) QgsLayoutItem ¶
Returns the
QgsLayoutItem
corresponding to a QModelIndexindex
, if possible.See also
- Parameters:
index (QModelIndex) –
- Return type:
- mimeData(self, indexes: Iterable[QModelIndex]) QMimeData ¶
- Parameters:
indexes (Iterable[QModelIndex]) –
- Return type:
QMimeData
- mimeTypes(self) List[str] ¶
- Return type:
List[str]
- parent(self, index: QModelIndex) QModelIndex ¶
- Parameters:
index (QModelIndex) –
- Return type:
QModelIndex
- persistentIndexList(self) List[QModelIndex] ¶
- receivers(self, PYQT_SIGNAL) int ¶
- removeRows(self, row: int, count: int, parent: QModelIndex = QModelIndex()) bool ¶
- Parameters:
row (int) –
count (int) –
parent (QModelIndex = QModelIndex()) –
- Return type:
bool
- resetInternalData(self)¶
- rowCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex()) –
- Return type:
int
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setData(self, index: QModelIndex, value: Any, role: int) bool ¶
- Parameters:
index (QModelIndex) –
value (Any) –
role (int) –
- Return type:
bool
- supportedDropActions(self) Qt.DropActions ¶
- Return type:
Qt.DropActions
- timerEvent(self, QTimerEvent)¶