1b24aff9052a85cb72f4426aadd2f63dcb8f7f05
[mdictionary] / src / mdictionary / gui / DictTypeModel.h
1 #ifndef DICTTYPEMODEL_H
2 #define DICTTYPEMODEL_H
3
4 #include <QAbstractListModel>
5 #include <QHash>
6 #include "../../include/GUIInterface.h"
7
8 class DictTypeModel : public QAbstractListModel
9 {
10     Q_OBJECT
11 public:
12     enum DictTypeRoles
13     {
14         TypeRole = Qt::UserRole + 1
15     };
16
17     explicit DictTypeModel(QList<CommonDictInterface*> plugins, QObject *parent = 0);
18
19     void setDictTypes(QList<CommonDictInterface*> plugins);
20
21     int rowCount(const QModelIndex & parent = QModelIndex()) const;
22
23     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
24
25 private:
26     QList<CommonDictInterface*> _plugins;
27
28     void addType(CommonDictInterface* plugin);
29 };
30
31 #endif // DICTTYPEMODEL_H