Class: QgsCheckableComboBox

class qgis.gui.QgsCheckableComboBox

Bases: PyQt5.QtWidgets.QComboBox

QComboBox subclass which allows selecting multiple items.

New in version 3.0.

QgsCheckableComboBox(parent: QWidget = None) Constructor for QgsCheckableComboBox.

Methods

actionEvent

addItemWithCheckState

Adds an item to the combobox with the given text, check state (stored in the Qt.CheckStateRole) and containing the specified userData (stored in the Qt.UserRole).

changeEvent

checkedItems

Returns currently checked items.

checkedItemsData

Returns userData (stored in the Qt.UserRole) associated with currently checked items.

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

defaultText

Returns default text which will be displayed in the widget when no items selected.

deselectAllOptions

Removes selection from all items.

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

eventFilter

Filters events to enable context menu

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

hidePopup

Hides the list of items in the combobox if it is currently visible and resets the internal state.

initPainter

initStyleOption

inputMethodEvent

isSignalConnected

itemCheckState

Returns the checked state of the item identified by index

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

Handler for widget resizing

selectAllOptions

Selects all items.

sender

senderSignalIndex

separator

Returns separator used to separate items in the display text.

setCheckedItems

Set items which should be checked/selected.

setDefaultText

Set default text which will be displayed in the widget when no items selected.

setItemCheckState

Sets the item check state to state

setSeparator

Set separator used to separate items in the display text.

sharedPainter

showContextMenu

Display context menu which allows selecting/deselecting all items at once.

showEvent

tabletEvent

timerEvent

toggleItemCheckState

Toggles the item check state

updateMicroFocus

wheelEvent

Signals

checkedItemsChanged

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

actionEvent(self, QActionEvent)
addItemWithCheckState(self, text: str, state: Qt.CheckState, userData: Any = None)

Adds an item to the combobox with the given text, check state (stored in the Qt.CheckStateRole) and containing the specified userData (stored in the Qt.UserRole). The item is appended to the list of existing items.

New in version 3.16.

Parameters:
  • text (str) –

  • state (Qt.CheckState) –

  • userData (Any = None) –

changeEvent(self, QEvent)
checkedItems(self) List[str]

Returns currently checked items.

Return type:

List[str]

checkedItemsChanged

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

checkedItemsData(self) List[Any]

Returns userData (stored in the Qt.UserRole) associated with currently checked items.

See also

checkedItems()

Return type:

List[Any]

childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
defaultText(self) str

Returns default text which will be displayed in the widget when no items selected.

See also

setDefaultText()

Return type:

str

deselectAllOptions(self)

Removes selection from all items.

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)
eventFilter(self, object: QObject, event: QEvent) bool

Filters events to enable context menu

Parameters:
  • object (QObject) –

  • event (QEvent) –

Return type:

bool

focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
hidePopup(self)

Hides the list of items in the combobox if it is currently visible and resets the internal state.

initPainter(self, QPainter)
initStyleOption(self, QStyleOptionComboBox)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
itemCheckState(self, index: int) Qt.CheckState

Returns the checked state of the item identified by index

Parameters:

index (int) – item index

Return type:

Qt.CheckState

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], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
resizeEvent(self, event: QResizeEvent)

Handler for widget resizing

Parameters:

event (QResizeEvent) –

selectAllOptions(self)

Selects all items.

sender(self) QObject
senderSignalIndex(self) int
separator(self) str

Returns separator used to separate items in the display text.

See also

setSeparator()

Return type:

str

setCheckedItems(self, items: Iterable[str])

Set items which should be checked/selected.

Parameters:

items (Iterable[str]) – items to select

See also

checkedItems()

setDefaultText(self, text: str)

Set default text which will be displayed in the widget when no items selected.

Parameters:

text (str) – default text

See also

defaultText()

setItemCheckState(self, index: int, state: Qt.CheckState)

Sets the item check state to state

Parameters:
  • index (int) – item index

  • state (Qt.CheckState) – check state

See also

itemCheckState()

setSeparator(self, separator: str)

Set separator used to separate items in the display text.

Parameters:

separator (str) – separator to use

See also

separator()

sharedPainter(self) QPainter
showContextMenu(self, pos: QPoint)

Display context menu which allows selecting/deselecting all items at once.

Parameters:

pos (QPoint) –

showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
toggleItemCheckState(self, index: int)

Toggles the item check state

Parameters:

index (int) – item index

See also

itemCheckState()

updateMicroFocus(self)
wheelEvent(self, QWheelEvent)