Class: QgsLayoutManagerModel

List model representing the print layouts and reports available in a layout manager.

Added in version 3.8.

Class Hierarchy

Inheritance diagram of qgis.core.QgsLayoutManagerModel

Base classes

QAbstractListModel

QAbstractItemModel

QObject

Enums

CustomRole

Custom model roles.

Role

alias of CustomRole

Methods

allowEmptyLayout

Returns True if the model allows the empty layout ("not set") choice.

indexFromLayout

Returns the model index corresponding to a layout.

layoutFromIndex

Returns the layout at the corresponding index.

setAllowEmptyLayout

Sets whether an optional empty layout ("not set") option is present in the model.

class qgis.core.QgsLayoutManagerModel[source]

Bases: QAbstractListModel

__init__(manager: QgsLayoutManager | None, parent: QObject | None = None)

Constructor for QgsLayoutManagerModel, showing the layouts from the specified manager.

Parameters:
class CustomRole(*values)

Bases: IntEnum

Custom model roles.

Note

Prior to QGIS 3.36 this was available as QgsLayoutManagerModel.Role

Added in version 3.36.

  • Layout: Layout object

    Available as QgsLayoutManagerModel.LayoutRole in older QGIS releases.

Role

alias of CustomRole

allowEmptyLayout(self) bool[source]

Returns True if the model allows the empty layout (“not set”) choice.

Return type:

bool

indexFromLayout(self, layout: QgsMasterLayoutInterface | None) QModelIndex[source]

Returns the model index corresponding to a layout.

Parameters:

layout (Optional[QgsMasterLayoutInterface])

Return type:

QModelIndex

layoutFromIndex(self, index: QModelIndex) QgsMasterLayoutInterface | None[source]

Returns the layout at the corresponding index.

Parameters:

index (QModelIndex)

Return type:

Optional[QgsMasterLayoutInterface]

setAllowEmptyLayout(self, allowEmpty: bool)[source]

Sets whether an optional empty layout (“not set”) option is present in the model.

Parameters:

allowEmpty (bool)