-
Notifications
You must be signed in to change notification settings - Fork 0
/
itemproxymodel.h
30 lines (26 loc) · 1.22 KB
/
itemproxymodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef ITEMPROXYMODEL_H
#define ITEMPROXYMODEL_H
#include <QSortFilterProxyModel>
#include <QObject>
/*! \class ItemProxyModel
* \brief Simple extension of the QSortFilterProxyModel providing missing flexible filter option. */
class ItemProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
/*! \brief Generic constructor. Calls parent's ctor directly.
* \param parent Parent objects pointer or nullptr */
ItemProxyModel(QObject *parent=nullptr);
protected:
/*! \brief Method juggling rows on which the model is sorted in the view.
*
* By override we provide needed option to display unread only or bookmarked only.
* The method switches coverage based on the column (inverted read bool or bookmark bool).
* Acceptance of the data for those two column is set on the criteria above. For any other
* column parent method is called.
* \param sourceRow Row in the source model
* \param sourceParent Index to the parent of the source data in source model
* \return True if the data indicated by row and index should be included in the model, false otherwise */
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
};
#endif // ITEMPROXYMODEL_H