Class: QgsCheckableComboBox¶
QComboBox subclass which allows selecting multiple items.
Class Hierarchy¶
Base classes¶
Methods
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). |
|
Returns currently checked items. |
|
Returns userData (stored in the Qt.UserRole) associated with currently checked items. |
|
Returns default text which will be displayed in the widget when no items selected. |
|
Removes selection from all items. |
|
Returns the checked state of the item identified by index |
|
Selects all items. |
|
Returns separator used to separate items in the display text. |
|
Set items which should be checked/selected. |
|
Set default text which will be displayed in the widget when no items selected. |
|
Sets the item check state to state |
|
Set separator used to separate items in the display text. |
|
Display context menu which allows selecting/deselecting all items at once. |
|
Toggles the item check state |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsCheckableComboBox. See the FAQ for more details.
Filters events to enable context menu |
|
Hides the list of items in the combobox if it is currently visible and resets the internal state. |
|
Handler for widget resizing |
Signals
Emitted whenever the checked items list changed. |
- class qgis.gui.QgsCheckableComboBox[source]¶
Bases:
QComboBox
- __init__(parent: QWidget | None = None)
Constructor for QgsCheckableComboBox.
- Parameters:
parent (Optional[QWidget] = None)
- addItemWithCheckState(self, text: str | None, state: Qt.CheckState, userData: Any = None)[source]¶
Adds an item to the combobox with the given
text
, checkstate
(stored in the Qt.CheckStateRole) and containing the specifieduserData
(stored in the Qt.UserRole). The item is appended to the list of existing items.Added in version 3.16.
- Parameters:
text (Optional[str])
state (Qt.CheckState)
userData (Any = None)
- checkedItems(self) List[str] [source]¶
Returns currently checked items.
See also
- Return type:
List[str]
- signal checkedItemsChanged(items: List[str])[source]¶
Emitted whenever the checked items list changed.
- Parameters:
items (List[str])
- checkedItemsData(self) List[Any] [source]¶
Returns userData (stored in the Qt.UserRole) associated with currently checked items.
See also
- Return type:
List[Any]
- defaultText(self) str [source]¶
Returns default text which will be displayed in the widget when no items selected.
See also
- Return type:
str
- virtual eventFilter(self, object: QObject | None, event: QEvent | None) bool [source]¶
Filters events to enable context menu
- Parameters:
object (Optional[QObject])
event (Optional[QEvent])
- Return type:
bool
- virtual hidePopup(self)[source]¶
Hides the list of items in the combobox if it is currently visible and resets the internal state.
- itemCheckState(self, index: int) Qt.CheckState [source]¶
Returns the checked state of the item identified by index
- Parameters:
index (int) – item index
See also
See also
- Return type:
Qt.CheckState
- virtual resizeEvent(self, event: QResizeEvent | None)[source]¶
Handler for widget resizing
- Parameters:
event (Optional[QResizeEvent])
- separator(self) str [source]¶
Returns separator used to separate items in the display text.
See also
- Return type:
str
- setCheckedItems(self, items: Iterable[str | None])[source]¶
Set items which should be checked/selected.
- Parameters:
items (Iterable[Optional[str]]) – items to select
See also
- setDefaultText(self, text: str | None)[source]¶
Set default text which will be displayed in the widget when no items selected.
- Parameters:
text (Optional[str]) – default text
See also
- setItemCheckState(self, index: int, state: Qt.CheckState)[source]¶
Sets the item check state to state
- Parameters:
index (int) – item index
state (Qt.CheckState) – check state
See also
See also
- setSeparator(self, separator: str | None)[source]¶
Set separator used to separate items in the display text.
- Parameters:
separator (Optional[str]) – separator to use
See also
- showContextMenu(self, pos: QPoint)[source]¶
Display context menu which allows selecting/deselecting all items at once.
- Parameters:
pos (QPoint)