QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
|
QComboBox subclass which allows selecting multiple items. More...
#include <qgscheckablecombobox.h>
Public Slots | |
void | setCheckedItems (const QStringList &items) |
Set items which should be checked/selected. More... | |
Signals | |
void | checkedItemsChanged (const QStringList &items) |
Emitted whenever the checked items list changed. More... | |
Public Member Functions | |
QgsCheckableComboBox (QWidget *parent=nullptr) | |
Constructor for QgsCheckableComboBox. More... | |
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). More... | |
QStringList | checkedItems () const |
Returns currently checked items. More... | |
QVariantList | checkedItemsData () const |
Returns userData (stored in the Qt::UserRole) associated with currently checked items. More... | |
QString | defaultText () const |
Returns default text which will be displayed in the widget when no items selected. More... | |
bool | eventFilter (QObject *object, QEvent *event) override |
Filters events to enable context menu. More... | |
void | hidePopup () override |
Hides the list of items in the combobox if it is currently visible and resets the internal state. More... | |
Qt::CheckState | itemCheckState (int index) const |
Returns the checked state of the item identified by index. More... | |
QgsCheckableItemModel * | model () const |
Returns the custom item model which handles checking the items. More... | |
QString | separator () const |
Returns separator used to separate items in the display text. More... | |
void | setDefaultText (const QString &text) |
Set default text which will be displayed in the widget when no items selected. More... | |
void | setItemCheckState (int index, Qt::CheckState state) |
Sets the item check state to state. More... | |
void | setSeparator (const QString &separator) |
Set separator used to separate items in the display text. More... | |
void | toggleItemCheckState (int index) |
Toggles the item check state. More... | |
Protected Slots | |
void | deselectAllOptions () |
Removes selection from all items. More... | |
void | selectAllOptions () |
Selects all items. More... | |
void | showContextMenu (QPoint pos) |
Display context menu which allows selecting/deselecting all items at once. More... | |
Protected Member Functions | |
void | resizeEvent (QResizeEvent *event) override |
Handler for widget resizing. More... | |
Protected Attributes | |
QgsCheckableItemModel * | mModel = nullptr |
Properties | |
QStringList | checkedItems |
QString | defaultText |
QString | separator |
QComboBox subclass which allows selecting multiple items.
Definition at line 124 of file qgscheckablecombobox.h.
QgsCheckableComboBox::QgsCheckableComboBox | ( | QWidget * | parent = nullptr | ) |
Constructor for QgsCheckableComboBox.
Definition at line 77 of file qgscheckablecombobox.cpp.
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.
Definition at line 138 of file qgscheckablecombobox.cpp.
QStringList QgsCheckableComboBox::checkedItems | ( | ) | const |
Returns currently checked items.
Definition at line 144 of file qgscheckablecombobox.cpp.
|
signal |
Emitted whenever the checked items list changed.
QVariantList QgsCheckableComboBox::checkedItemsData | ( | ) | const |
Returns userData (stored in the Qt::UserRole) associated with currently checked items.
Definition at line 162 of file qgscheckablecombobox.cpp.
QString QgsCheckableComboBox::defaultText | ( | ) | const |
Returns default text which will be displayed in the widget when no items selected.
Definition at line 124 of file qgscheckablecombobox.cpp.
|
protectedslot |
Removes selection from all items.
Definition at line 228 of file qgscheckablecombobox.cpp.
|
override |
Filters events to enable context menu.
Definition at line 239 of file qgscheckablecombobox.cpp.
|
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.
Qt::CheckState QgsCheckableComboBox::itemCheckState | ( | int | index | ) | const |
Returns the checked state of the item identified by index.
index | item index |
Definition at line 180 of file qgscheckablecombobox.cpp.
|
inline |
Returns the custom item model which handles checking the items.
Definition at line 218 of file qgscheckablecombobox.h.
|
overrideprotected |
Handler for widget resizing.
Definition at line 287 of file qgscheckablecombobox.cpp.
|
protectedslot |
Selects all items.
Definition at line 217 of file qgscheckablecombobox.cpp.
QString QgsCheckableComboBox::separator | ( | ) | const |
Returns separator used to separate items in the display text.
Definition at line 110 of file qgscheckablecombobox.cpp.
|
slot |
Set items which should be checked/selected.
items | items to select |
Definition at line 276 of file qgscheckablecombobox.cpp.
void QgsCheckableComboBox::setDefaultText | ( | const QString & | text | ) |
Set default text which will be displayed in the widget when no items selected.
text | default text |
Definition at line 129 of file qgscheckablecombobox.cpp.
void QgsCheckableComboBox::setItemCheckState | ( | int | index, |
Qt::CheckState | state | ||
) |
Sets the item check state to state.
index | item index |
state | check state |
Definition at line 185 of file qgscheckablecombobox.cpp.
void QgsCheckableComboBox::setSeparator | ( | const QString & | separator | ) |
Set separator used to separate items in the display text.
separator | separator to use |
Definition at line 115 of file qgscheckablecombobox.cpp.
|
protectedslot |
Display context menu which allows selecting/deselecting all items at once.
Definition at line 210 of file qgscheckablecombobox.cpp.
void QgsCheckableComboBox::toggleItemCheckState | ( | int | index | ) |
Toggles the item check state.
index | item index |
Definition at line 190 of file qgscheckablecombobox.cpp.
|
protected |
Definition at line 273 of file qgscheckablecombobox.h.
|
readwrite |
Definition at line 114 of file qgscheckablecombobox.h.
|
readwrite |
Definition at line 114 of file qgscheckablecombobox.h.
|
readwrite |
Definition at line 114 of file qgscheckablecombobox.h.