checkablecomboboxmodel.h 519 Bytes
Newer Older
Giacomo Strangolino's avatar
Giacomo Strangolino committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef CHECKABLECOMBOBOXMODEL_H
#define CHECKABLECOMBOBOXMODEL_H

#include <QStandardItemModel>

class CheckableComboBoxModel : public QStandardItemModel
{
    Q_OBJECT
public:
    enum DataRole { SrcRole = Qt::UserRole + 1 };

    explicit CheckableComboBoxModel(QObject *parent);
    QStandardItem *addItem(const QString& i, bool checkable = true);

private slots:
    void onItemChanged(QStandardItem * it);

signals:
    void itemChecked(const QString& text, bool checked);

};

#endif // CHECKABLECOMBOBOXMODEL_H