Export to QML the StationListProxyModel methods
[quandoparte] / application / stationlistproxymodel.h
1 #ifndef STATIONLISTPROXYMODEL_H
2 #define STATIONLISTPROXYMODEL_H
3
4 #include <QSortFilterProxyModel>
5 #include <QGeoCoordinate>
6 #include <QStringList>
7
8 QTM_USE_NAMESPACE
9
10 class StationListProxyModel : public QSortFilterProxyModel
11 {
12     Q_OBJECT
13
14 public:
15     explicit StationListProxyModel(QObject *parent = 0);
16     Q_INVOKABLE void setUserPosition(const QGeoCoordinate &pos);
17     Q_INVOKABLE void setRecentStations(const QStringList &stations);
18     Q_INVOKABLE void setRecentOnlyFilter(bool);
19
20 protected:
21     virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
22     virtual bool filterAcceptsRow(int sourceRow,
23             const QModelIndex &sourceParent) const;
24
25 private:
26     QGeoCoordinate m_here;
27     QStringList m_stations;
28     bool m_filterRecentOnly;
29 };
30
31 #endif // STATIONLISTPROXYMODEL_H