X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=src%2Fjourneymodel.cpp;h=1dc7d58685d1e61e3a06921934b10d56c6ef570b;hp=80a5eb593ec1b48c7de07df2f9cfceb42e35b32a;hb=5fc520bad80dccf9bf2e0f16552c9f2605417067;hpb=371dcf3335b355f8d421352a394161dc6d9b9f24 diff --git a/src/journeymodel.cpp b/src/journeymodel.cpp index 80a5eb5..1dc7d58 100644 --- a/src/journeymodel.cpp +++ b/src/journeymodel.cpp @@ -30,6 +30,12 @@ void JourneyModel::editJourney(quint32 index, QDateTime start, quint32 duration, emit dataChanged(createIndex(index, 0), createIndex(index, 0)); } +void JourneyModel::deleteJourney(quint32 index) { + beginRemoveRows(QModelIndex(), index, index); + journeys.removeAt(index); + endRemoveRows(); +} + int JourneyModel::rowCount(const QModelIndex & parent) const { Q_UNUSED(parent) return journeys.count(); @@ -99,9 +105,7 @@ void JourneyModel::importFromFile(QFile & file) { QDate JourneyModel::epochToDate(quint64 epoch) { QDateTime date; - qDebug() << "Epoch: " << epoch; date.setMSecsSinceEpoch(epoch); - qDebug() << "Date: " << date.date(); return date.date(); } @@ -118,3 +122,7 @@ QDateTime JourneyModel::epochToDateTime(quint64 epoch) { date.setMSecsSinceEpoch(epoch); return date; } + +QList const & JourneyModel::getData() const { + return journeys; +}