1 #pragma once
2 #include <QAbstractListModel>
3 
4 class BaseListModel : public QAbstractListModel
5 {
6     Q_OBJECT
7 
8     public:
9         BaseListModel(QObject *parent = Q_NULLPTR);
~BaseListModel()10         virtual ~BaseListModel() {}
11 
12     protected:
13         QVariantMap getRowRaw(int row);
14 
isIndexValid(const QModelIndex & index)15         inline bool isIndexValid(const QModelIndex &index) const
16         {
17             return 0 <= index.row() && index.row() < rowCount();
18         }
19 
isRowIndexValid(int row)20         inline bool isRowIndexValid(int row) const
21         {
22             return 0 <= row && row < rowCount();
23         }
24 };
25