Class: QgsLayoutItemComboBox

class qgis.gui.QgsLayoutItemComboBox

Bases: PyQt5.QtWidgets.QComboBox

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

QgsLayoutItemComboBox(parent: Optional[QWidget] = None, layout: Optional[QgsLayout] = None) 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

Methods

actionEvent

allowEmptyItem

Returns True if the model includes the empty item choice.

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

currentItem

Returns the item currently selected in the combo box.

currentLayout

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

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

exceptedItemList

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

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

initStyleOption

inputMethodEvent

isSignalConnected

item

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

itemFlags

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

itemType

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

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setAllowEmptyItem

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

setCurrentLayout

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

setExceptedItemList

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

setItem

Sets the currently selected item in the combo box.

setItemFlags

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

setItemType

Sets a filter for the item type to show in the combo box.

sharedPainter

showEvent

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

itemChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

actionEvent(self, a0: QActionEvent | None)
allowEmptyItem(self) bool

Returns True if the model includes the empty item choice.

Added in version 3.8.

Return type:

bool

changeEvent(self, e: QEvent | None)
childEvent(self, a0: QChildEvent | None)
closeEvent(self, a0: QCloseEvent | None)
connectNotify(self, signal: QMetaMethod)
contextMenuEvent(self, e: QContextMenuEvent | None)
create(self, window: PyQt5.sip.voidptr = None, initializeWindow: bool = True, destroyOldWindow: bool = True)
currentItem(self) QgsLayoutItem | None

Returns the item currently selected in the combo box.

Return type:

Optional[QgsLayoutItem]

currentLayout(self) QgsLayout | None

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

Return type:

Optional[QgsLayout]

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

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

Return type:

List[QgsLayoutItem]

focusInEvent(self, e: QFocusEvent | None)
focusNextChild(self) bool
focusNextPrevChild(self, next: bool) bool
focusOutEvent(self, e: QFocusEvent | None)
focusPreviousChild(self) bool
hideEvent(self, e: QHideEvent | None)
initPainter(self, painter: QPainter | None)
initStyleOption(self, option: QStyleOptionComboBox | None)
inputMethodEvent(self, a0: QInputMethodEvent | None)
isSignalConnected(self, signal: QMetaMethod) bool
item(self, index: int) QgsLayoutItem | None

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

See also

currentItem()

Parameters:

index (int)

Return type:

Optional[QgsLayoutItem]

itemChanged

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.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL

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()

Added 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, e: QKeyEvent | None)
keyReleaseEvent(self, e: QKeyEvent | None)
leaveEvent(self, a0: QEvent | None)
metric(self, a0: QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, a0: QMouseEvent | None)
mouseMoveEvent(self, a0: QMouseEvent | None)
mousePressEvent(self, e: QMouseEvent | None)
mouseReleaseEvent(self, e: QMouseEvent | None)
moveEvent(self, a0: QMoveEvent | None)
nativeEvent(self, eventType: QByteArray | bytes | bytearray, message: PyQt5.sip.voidptr | None)
paintEvent(self, e: QPaintEvent | None)
receivers(self, signal: PYQT_SIGNAL) int
resizeEvent(self, e: QResizeEvent | None)
sender(self) QObject | None
senderSignalIndex(self) int
setAllowEmptyItem(self, allowEmpty: bool)

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

See also

allowEmptyItem()

Added in version 3.8.

Parameters:

allowEmpty (bool)

setCurrentLayout(self, layout: QgsLayout | None)

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

See also

currentLayout()

Parameters:

layout (Optional[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 | None)

Sets the currently selected item in the combo box.

Parameters:

item (Optional[QgsLayoutItem])

setItemFlags(self, flags: 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()

Added 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 | None
showEvent(self, e: QShowEvent | None)
tabletEvent(self, a0: QTabletEvent | None)
timerEvent(self, a0: QTimerEvent | None)
updateMicroFocus(self)
wheelEvent(self, e: QWheelEvent | None)