4 #include <QAbstractListModel>
10 class JourneyModel
: public QAbstractListModel
15 StartRole
= Qt::UserRole
+ 1,
21 QHash
<int, QByteArray
> roleNames() const;
23 JourneyModel(QObject
*parent
= 0);
25 void addJourney(const Journey
&journey
);
26 Q_INVOKABLE
void addJourney(QDateTime start
, quint32 duration
, quint32 overtook
, quint32 overtakenby
);
28 int rowCount(const QModelIndex
& parent
= QModelIndex()) const;
30 QVariant
data(const QModelIndex
& index
, int role
= Qt::DisplayRole
) const;
34 void exportToFile(QFile
& file
);
35 void importFromFile(QFile
& file
);
37 Q_INVOKABLE
static QDate
epochToDate(quint64 epoch
);
38 Q_INVOKABLE
static QTime
epochToTime(quint64 epoch
);
41 void journeysChanged();
44 QHash
<int, QByteArray
> roles
;
45 QList
<Journey
> journeys
;
48 #endif // JOURNEYMODEL_H