/ proxyroles / proxyrole.h
proxyrole.h
1 #ifndef PROXYROLE_H 2 #define PROXYROLE_H 3 4 #include <QObject> 5 #include <QMutex> 6 7 namespace qqsfpm { 8 9 class QQmlSortFilterProxyModel; 10 11 class ProxyRole : public QObject 12 { 13 Q_OBJECT 14 15 public: 16 using QObject::QObject; 17 virtual ~ProxyRole() = default; 18 19 QVariant roleData(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel, const QString& name); 20 virtual void proxyModelCompleted(const QQmlSortFilterProxyModel& proxyModel); 21 22 virtual QStringList names() = 0; 23 24 protected: 25 void invalidate(); 26 27 Q_SIGNALS: 28 void invalidated(); 29 void namesAboutToBeChanged(); 30 void namesChanged(); 31 32 private: 33 virtual QVariant data(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel, const QString& name) = 0; 34 35 QMutex m_mutex; 36 }; 37 38 } 39 40 #endif // PROXYROLE_H