Class: QgsLayoutItemComboBox

class qgis.gui.QgsLayoutItemComboBox(parent: QWidget = None, layout: QgsLayout = None)

Bases: PyQt5.QtWidgets.QComboBox

QgsLayoutItemComboBox creates a combo box to display a list of items in a layout. The items can optionally be filtered by type. If layout is not set, no items will be shown until setCurrentLayout() is called

The QgsLayoutItemComboBox class is a combo box which displays items of a matching type from a layout.

New in version 3.0.

Parameters
  • parent (QWidget = None) –

  • layout

actionEvent(self, QActionEvent)
allowEmptyItem(self) → bool

Returns True if the model includes the empty item choice.

New in version 3.8.

Return type

bool

changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
currentItem(self)QgsLayoutItem

Returns the item currently selected in the combo box.

Return type

QgsLayoutItem

currentLayout(self)QgsLayout

Returns the current layout containing the items shown in the combo box.

Return type

QgsLayout

customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
exceptedItemList(self) → List[QgsLayoutItem]

Returns the list of specific items excluded from the combo box.

Return type

List[QgsLayoutItem]

focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) → bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionComboBox)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) → bool
item(self, index: int)QgsLayoutItem

Returns the item currently shown at the specified index within the combo box.

See also

currentItem()

Parameters

index (int) –

Return type

QgsLayoutItem

itemChanged

Emitted whenever the currently selected item changes [signal]

Parameters

item (QgsLayoutItem) –

itemFlags(self) → QgsLayoutItem.Flags

Returns the layout item flags used for filtering the available items.

Returns None if no flag based filtering is occurring.

See also

setItemFlags()

New in version 3.16.

Return type

QgsLayoutItem.Flags

itemType(self) → QgsLayoutItemRegistry.ItemType

Returns the filter for the item types to show in the combo box.

See also

setItemType()

Return type

QgsLayoutItemRegistry.ItemType

keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) → int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) → int
resizeEvent(self, QResizeEvent)
sender(self) → QObject
senderSignalIndex(self) → int
setAllowEmptyItem(self, allowEmpty: bool)

Sets whether an optional empty layout item is present in the combobox.

See also

allowEmptyItem()

New in version 3.8.

Parameters

allowEmpty (bool) –

setCurrentLayout(self, layout: QgsLayout)

Sets the layout containing the items to list in the combo box.

See also

currentLayout()

Parameters

layout (QgsLayout) –

setExceptedItemList(self, exceptList: Iterable[QgsLayoutItem])

Sets a list of specific items to exclude from the combo box.

Parameters

exceptList (Iterable[QgsLayoutItem]) –

setItem(self, item: QgsLayoutItem)

Sets the currently selected item in the combo box.

Parameters

item (QgsLayoutItem) –

setItemFlags(self, flags: Union[QgsLayoutItem.Flags, QgsLayoutItem.Flag])

Sets layout item flags to use for filtering the available items.

Set flags to None to clear the flag based filtering.

See also

itemFlags()

New in version 3.16.

Parameters

flags (Union[QgsLayoutItem.Flags) –

setItemType(self, itemType: QgsLayoutItemRegistry.ItemType)

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

itemType()

sharedPainter(self) → QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)