18 #ifndef QGSCHECKABLECOMBOBOX_H
19 #define QGSCHECKABLECOMBOBOX_H
23 #include <QStandardItemModel>
24 #include <QStyledItemDelegate>
58 Qt::ItemFlags
flags(
const QModelIndex &index )
const override;
66 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
75 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
113 void paint( QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
127 Q_PROPERTY( QString separator READ separator WRITE setSeparator )
128 Q_PROPERTY( QString defaultText READ defaultText WRITE setDefaultText )
129 Q_PROPERTY( QStringList checkedItems READ checkedItems WRITE setCheckedItems )
142 QString separator() const;
149 void setSeparator( const QString &separator );
156 QString defaultText() const;
164 void setDefaultText( const QString &text );
170 QStringList checkedItems() const;
177 QVariantList checkedItemsData() const;
185 Qt::CheckState itemCheckState(
int index ) const;
194 void setItemCheckState(
int index, Qt::CheckState state );
202 void toggleItemCheckState(
int index );
208 void hidePopup() override;
213 bool eventFilter( QObject *
object, QEvent *event ) override;
220 void checkedItemsChanged( const QStringList &items );
229 void setCheckedItems( const QStringList &items );
236 void resizeEvent( QResizeEvent *event ) override;
244 void showContextMenu( QPoint pos );
249 void selectAllOptions();
254 void deselectAllOptions();
257 void updateCheckedItems();
258 void updateDisplayText();
261 QString mDefaultText;
263 bool mSkipHide = false;
265 QMenu *mContextMenu =
nullptr;
266 QAction *mSelectAllAction =
nullptr;
267 QAction *mDeselectAllAction =
nullptr;
270 #endif // QGSCHECKABLECOMBOBOX_H