*/
-#include <QStandardItemModel>
+#include <QAbstractItemModel>
+#include <QSet>
#include <QXmlStreamReader>
-class QStandardItem;
+#include "stationitem.h"
+
+class StationItem;
class StationListModel;
-class StationListModel : public QStandardItemModel
+class StationListModel : public QAbstractListModel
{
Q_OBJECT
Q_ENUMS(StationListRole)
QHash<int, QByteArray> roleNames() const;
- // Needed to make SectionScroller happy.
+ Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const;
Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
+ Q_INVOKABLE QVariant data(const QModelIndex &index, int role) const;
+ Q_INVOKABLE bool setData(const QModelIndex &index, QVariant &value, int role = Qt::EditRole);
signals:
private:
void readStationsElement();
void readStationElement();
- void readPosElement(QStandardItem *item);
- void readNameElement(QStandardItem *item);
- void readCodeElement(QStandardItem *item);
+ void readPosElement(StationItem &item);
+ void readNameElement(StationItem &item);
+ void readCodeElement(StationItem &item);
void skipUnknownElement(const QString &name = QString());
QXmlStreamReader m_reader;
+ QList<StationItem> m_stations;
+ QSet<QString> m_favorites;
};
#endif // STATIONLISTMODEL_H