Class: QgsLayoutProxyModel¶
Allows for filtering a QgsLayoutModel by item type.
Class Hierarchy¶
Base classes¶
Methods
Returns   | 
|
Returns the list of specific items excluded from the model.  | 
|
Returns the current item type filter, or   | 
|
Returns the layout item flags used for filtering the available items.  | 
|
Returns the   | 
|
Returns the associated layout.  | 
|
Sets whether an optional empty layout item is present in the model.  | 
|
Sets a list of specific items to exclude from the model.  | 
|
Sets the item type filter.  | 
|
Sets layout item flags to use for filtering the available items.  | 
|
Returns the   | 
- class qgis.core.QgsLayoutProxyModel[source]¶
 Bases:
QSortFilterProxyModel- __init__(layout: QgsLayout | None, parent: QObject | None = None)
 Constructor for
QgsLayoutProxyModelm, attached to the specifiedlayout.- Parameters:
 layout (Optional[QgsLayout])
parent (Optional[QObject] = None)
- allowEmptyItem(self) bool[source]¶
 Returns
Trueif the model includes the empty item choice.See also
Added in version 3.8.
- Return type:
 bool
- exceptedItemList(self) List[QgsLayoutItem]¶
 Returns the list of specific items excluded from the model.
See also
- Return type:
 List[QgsLayoutItem]
- filterType(self) QgsLayoutItemRegistry.ItemType[source]¶
 Returns the current item type filter, or
QgsLayoutItemRegistry.LayoutItem if no item type filter is set.See also
- Return type:
 
- itemFlags(self) QgsLayoutItem.Flags[source]¶
 Returns the layout item flags used for filtering the available items.
Returns
Noneif no flag based filtering is occurring.See also
Added in version 3.16.
- Return type:
 
- itemFromSourceIndex(self, sourceIndex: QModelIndex) QgsLayoutItem | None[source]¶
 Returns the
QgsLayoutItemcorresponding to an index from the sourceQgsLayoutModelmodel.- Parameters:
 sourceIndex (QModelIndex)
- Return type:
 Optional[QgsLayoutItem]
- layout(self) QgsLayout | None[source]¶
 Returns the associated layout.
Added in version 3.8.
- Return type:
 Optional[QgsLayout]
- setAllowEmptyItem(self, allowEmpty: bool)[source]¶
 Sets whether an optional empty layout item is present in the model.
See also
Added in version 3.8.
- Parameters:
 allowEmpty (bool)
- setExceptedItemList(self, items: Iterable[QgsLayoutItem])[source]¶
 Sets a list of specific
itemsto exclude from the model.See also
- Parameters:
 items (Iterable[QgsLayoutItem])
- setFilterType(self, filter: QgsLayoutItemRegistry.ItemType)[source]¶
 Sets the item type
filter. Only matching item types will be shown. SetfiltertoQgsLayoutItemRegistry.LayoutItem to show all item types.See also
- Parameters:
 filter (QgsLayoutItemRegistry.ItemType)
- setItemFlags(self, flags: QgsLayoutItem.Flags | QgsLayoutItem.Flag)[source]¶
 Sets layout item flags to use for filtering the available items.
Set
flagstoNoneto clear the flag based filtering.See also
Added in version 3.16.
- Parameters:
 flags (Union[QgsLayoutItem.Flags, QgsLayoutItem.Flag])
- sourceLayerModel(self) QgsLayoutModel | None[source]¶
 Returns the
QgsLayoutModelused in this proxy model.- Return type:
 Optional[QgsLayoutModel]