Quark  0.1
BasicFilterTreeModel.h++
Go to the documentation of this file.
1 
2 #ifndef __libquark_gui_BasicFilterTreeModel_hxx
3 #define __libquark_gui_BasicFilterTreeModel_hxx
4 
5 #include <QSortFilterProxyModel>
6 
8 
9 namespace quark {
10 namespace gui {
11 
24 template<class T, class IS = QDataStream, class OS = QDataStream>
25 class BasicFilterTreeModel : public QSortFilterProxyModel
26 {
27  public:
28 
30  virtual ~BasicFilterTreeModel();
31 
33  T* getItemForIndex(const QModelIndex& index) const;
34 
37  { return(_sourceModel); }
38 
39  protected:
40 
43  QObject *parent = NULL);
44 
54  virtual bool filterAcceptsItem(const T &item) const;
55 
65  virtual bool filterAcceptsField(int field) const;
66 
77  virtual bool fieldLessThan(int field, const QVariant &value1,
78  const QVariant &value2) const;
79 
82  virtual bool filterAcceptsRow(int sourceRow,
83  const QModelIndex &sourceParent) const;
84  virtual bool filterAcceptsColumn(int sourceColumn,
85  const QModelIndex &sourceParent) const;
86  virtual bool lessThan(const QModelIndex &left, const QModelIndex &right)
87  const;
88 
89  BasicTreeModel<T, IS, OS> *_sourceModel;
90 
92 };
93 
94 #include <quark/BasicFilterTreeModelImpl.h++>
95 
96 } // namespace gui
97 } // namespace quark
98 
99 #endif // __libquark_gui_BasicFilterTreeModel_hxx
virtual ~BasicFilterTreeModel()
Destructor.
Definition: BasicTreeModel.h++:22
virtual bool fieldLessThan(int field, const QVariant &value1, const QVariant &value2) const
Compares the values of a given field of two items in the model, for the purpose of sorting...
An abstract subclass of QSortFilterProxyModel for sorting and filtering of AbstractTreeModels.
Definition: BasicFilterTreeModel.h++:25
BasicTreeModel< T, IS, OS > * sourceModel() const
Returns this filter model&#39;s source model.
Definition: BasicFilterTreeModel.h++:36
virtual bool filterAcceptsField(int field) const
Called to test whether a given field in the model is accepted by this filter.
T * getItemForIndex(const QModelIndex &index) const
Returns the filtered item at the given index in this model.
virtual bool filterAcceptsItem(const T &item) const
Called to test whether a given item in the model is accepted by this filter.
Definition: BarChartView.h++:6
BasicFilterTreeModel(BasicTreeModel< T, IS, OS > *sourceModel, QObject *parent=NULL)
Constructs a new BasicFilterTreeModel with the given source model.