1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, http://www.bibletime.info/.
6 *
7 * Copyright 1999-2016 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #ifndef ROLEITEMMODEL_H
14 #define ROLEITEMMODEL_H
15 
16 #include <QStandardItemModel>
17 
18 /* class to allow easily exposing
19    C++ data as a model for QML View.
20 */
21 
22 class RoleItemModel : public QStandardItemModel {
23 public:
24     //  roleNames is a map describing what role id (e.g. Qt::UserRole+1)
25     //  is associated with what name on QML side (e.g. 'bookTitle')
26     //  RoleItemModel(const QHash<int, QByteArray> &roleNames);
27 
28     QHash<int, QByteArray> roleNames() const override;
29     void setRoleNames(const QHash<int, QByteArray> &roleNames);
30 
31 private:
32     QHash<int, QByteArray> m_roleNames;
33 
34 };
35 
36 #endif // ROLEITEMMODEL_H
37