filtersorter.h
1 #ifndef FILTERSORTER_H 2 #define FILTERSORTER_H 3 4 #include "sorter.h" 5 #include "filters/filtercontainer.h" 6 7 namespace qqsfpm { 8 9 class FilterSorter : public Sorter, public FilterContainer 10 { 11 Q_OBJECT 12 Q_INTERFACES(qqsfpm::FilterContainer) 13 Q_PROPERTY(QQmlListProperty<qqsfpm::Filter> filters READ filtersListProperty) 14 Q_CLASSINFO("DefaultProperty", "filters") 15 16 public: 17 using Sorter::Sorter; 18 19 protected: 20 int compare(const QModelIndex &sourceLeft, const QModelIndex &sourceRight, const QQmlSortFilterProxyModel &proxyModel) const override; 21 22 private: 23 void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel) override; 24 void onFilterAppended(Filter *filter) override; 25 void onFilterRemoved(Filter *filter) override; 26 void onFiltersCleared() override; 27 28 bool indexIsAccepted(const QModelIndex &sourceIndex, const QQmlSortFilterProxyModel &proxyModel) const; 29 }; 30 31 } 32 33 #endif // FILTERSORTER_H