Class: QgsLayoutItemComboBox¶
A combo box which displays items of a matching type from a layout.
QgsLayoutItemComboBox in the collapsed state¶
QgsLayoutItemComboBox in the expanded state¶
Class Hierarchy¶
Base classes¶
- class qgis.gui.QgsLayoutItemComboBox[source]¶
Bases:
QComboBox- __init__(parent: QWidget | None = None, layout: QgsLayout | None = None)
QgsLayoutItemComboBox creates a combo box to display a list of items in a
layout. The items can optionally be filtered by type. Iflayoutis not set, no items will be shown untilsetCurrentLayout()is called- Parameters:
parent (Optional[QWidget] = None)
layout (Optional[QgsLayout] = None)
- allowEmptyItem(self) bool[source]¶
Returns
Trueif the model includes the empty item choice.See also
Added in version 3.8.
- Return type:
bool
- currentItem(self) QgsLayoutItem | None[source]¶
Returns the item currently selected in the combo box.
- Return type:
Optional[QgsLayoutItem]
- currentLayout(self) QgsLayout | None[source]¶
Returns the current layout containing the items shown in the combo box.
See also
- Return type:
Optional[QgsLayout]
- exceptedItemList(self) List[QgsLayoutItem]¶
Returns the list of specific items excluded from the combo box.
See also
- Return type:
- item(self, index: int) QgsLayoutItem | None[source]¶
Returns the item currently shown at the specified
indexwithin the combo box.See also
- Parameters:
index (int)
- Return type:
Optional[QgsLayoutItem]
- signal itemChanged[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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:
- itemType(self) QgsLayoutItemRegistry.ItemType[source]¶
Returns the filter for the item types to show in the combo box.
See also
- Return type:
- setAllowEmptyItem(self, allowEmpty: bool)[source]¶
Sets whether an optional empty layout item is present in the combobox.
See also
Added in version 3.8.
- Parameters:
allowEmpty (bool)
- setCurrentLayout(self, layout: QgsLayout | None)[source]¶
Sets the
layoutcontaining the items to list in the combo box.See also
- Parameters:
layout (Optional[QgsLayout])
- setExceptedItemList(self, exceptList: Iterable[QgsLayoutItem])[source]¶
Sets a list of specific items to exclude from the combo box.
See also
- Parameters:
exceptList (Iterable[QgsLayoutItem])
- setItem(self, item: QgsLayoutItem | None)[source]¶
Sets the currently selected
itemin the combo box.- Parameters:
item (Optional[QgsLayoutItem])
- 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])
- setItemType(self, itemType: QgsLayoutItemRegistry.ItemType)[source]¶
Sets a filter for the item type to show in the combo box.
- Parameters:
itemType (QgsLayoutItemRegistry.ItemType) – type of items to show. Set to
QgsLayoutItemRegistry.LayoutItem to show all items.
See also