QComboBox subclass which allows selecting multiple items.
More...
#include <qgscheckablecombobox.h>
|
void | setCheckedItems (const QStringList &items) |
| Set items which should be checked/selected.
|
|
|
void | checkedItemsChanged (const QStringList &items) |
| Emitted whenever the checked items list changed.
|
|
|
| QgsCheckableComboBox (QWidget *parent=nullptr) |
| Constructor for QgsCheckableComboBox.
|
|
void | addItemWithCheckState (const QString &text, Qt::CheckState state, const QVariant &userData=QVariant()) |
| 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).
|
|
QStringList | checkedItems () const |
| Returns currently checked items.
|
|
QVariantList | checkedItemsData () const |
| Returns userData (stored in the Qt::UserRole) associated with currently checked items.
|
|
QString | defaultText () const |
| Returns default text which will be displayed in the widget when no items selected.
|
|
bool | eventFilter (QObject *object, QEvent *event) override |
| Filters events to enable context menu.
|
|
void | hidePopup () override |
| Hides the list of items in the combobox if it is currently visible and resets the internal state.
|
|
Qt::CheckState | itemCheckState (int index) const |
| Returns the checked state of the item identified by index.
|
|
QgsCheckableItemModel * | model () const |
| Returns the custom item model which handles checking the items.
|
|
QString | separator () const |
| Returns separator used to separate items in the display text.
|
|
void | setDefaultText (const QString &text) |
| Set default text which will be displayed in the widget when no items selected.
|
|
void | setItemCheckState (int index, Qt::CheckState state) |
| Sets the item check state to state.
|
|
void | setSeparator (const QString &separator) |
| Set separator used to separate items in the display text.
|
|
void | toggleItemCheckState (int index) |
| Toggles the item check state.
|
|
|
void | resizeEvent (QResizeEvent *event) override |
| Handler for widget resizing.
|
|
QComboBox subclass which allows selecting multiple items.
Definition at line 121 of file qgscheckablecombobox.h.
◆ QgsCheckableComboBox()
QgsCheckableComboBox::QgsCheckableComboBox |
( |
QWidget * |
parent = nullptr | ) |
|
◆ addItemWithCheckState()
void QgsCheckableComboBox::addItemWithCheckState |
( |
const QString & |
text, |
|
|
Qt::CheckState |
state, |
|
|
const QVariant & |
userData = QVariant() |
|
) |
| |
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.
- Since
- QGIS 3.16
Definition at line 138 of file qgscheckablecombobox.cpp.
◆ checkedItems()
QStringList QgsCheckableComboBox::checkedItems |
( |
| ) |
const |
◆ checkedItemsChanged
void QgsCheckableComboBox::checkedItemsChanged |
( |
const QStringList & |
items | ) |
|
|
signal |
Emitted whenever the checked items list changed.
◆ checkedItemsData()
QVariantList QgsCheckableComboBox::checkedItemsData |
( |
| ) |
const |
◆ defaultText()
QString QgsCheckableComboBox::defaultText |
( |
| ) |
const |
◆ deselectAllOptions
void QgsCheckableComboBox::deselectAllOptions |
( |
| ) |
|
|
protectedslot |
◆ eventFilter()
bool QgsCheckableComboBox::eventFilter |
( |
QObject * |
object, |
|
|
QEvent * |
event |
|
) |
| |
|
override |
◆ hidePopup()
void QgsCheckableComboBox::hidePopup |
( |
| ) |
|
|
override |
Hides the list of items in the combobox if it is currently visible and resets the internal state.
Definition at line 201 of file qgscheckablecombobox.cpp.
◆ itemCheckState()
Qt::CheckState QgsCheckableComboBox::itemCheckState |
( |
int |
index | ) |
const |
◆ model()
◆ resizeEvent()
void QgsCheckableComboBox::resizeEvent |
( |
QResizeEvent * |
event | ) |
|
|
overrideprotected |
◆ selectAllOptions
void QgsCheckableComboBox::selectAllOptions |
( |
| ) |
|
|
protectedslot |
◆ separator()
QString QgsCheckableComboBox::separator |
( |
| ) |
const |
◆ setCheckedItems
void QgsCheckableComboBox::setCheckedItems |
( |
const QStringList & |
items | ) |
|
|
slot |
◆ setDefaultText()
void QgsCheckableComboBox::setDefaultText |
( |
const QString & |
text | ) |
|
◆ setItemCheckState()
void QgsCheckableComboBox::setItemCheckState |
( |
int |
index, |
|
|
Qt::CheckState |
state |
|
) |
| |
◆ setSeparator()
void QgsCheckableComboBox::setSeparator |
( |
const QString & |
separator | ) |
|
◆ showContextMenu
void QgsCheckableComboBox::showContextMenu |
( |
QPoint |
pos | ) |
|
|
protectedslot |
◆ toggleItemCheckState()
void QgsCheckableComboBox::toggleItemCheckState |
( |
int |
index | ) |
|
◆ mModel
◆ checkedItems
QStringList QgsCheckableComboBox::checkedItems |
|
readwrite |
◆ defaultText
QString QgsCheckableComboBox::defaultText |
|
readwrite |
◆ separator
QString QgsCheckableComboBox::separator |
|
readwrite |
The documentation for this class was generated from the following files: