From ac6a7ab24e087cc150a7eff0ff6e7e4f8c52ce9a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 29 May 2015 22:22:24 -0300 Subject: Update DiveLocationModel when thread finishes This patch updates the DiveLocationModel when the GeoLoockupInformationThread finishes, and also selects the correct index for the displayed dive. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-models/divelocationmodel.cpp | 6 ++++++ qt-models/divelocationmodel.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'qt-models') diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index a5303da49..973452b16 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -1,6 +1,12 @@ #include "divelocationmodel.h" #include "dive.h" +LocationInformationModel *LocationInformationModel::instance() +{ + static LocationInformationModel *self = new LocationInformationModel(); + return self; +} + LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractListModel(obj), internalRowCount(0) { } diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h index 1bf7cedfd..ee5f3c362 100644 --- a/qt-models/divelocationmodel.h +++ b/qt-models/divelocationmodel.h @@ -6,11 +6,13 @@ class LocationInformationModel : public QAbstractListModel { Q_OBJECT public: - LocationInformationModel(QObject *obj = 0); + static LocationInformationModel *instance(); int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index = QModelIndex(), int role = Qt::DisplayRole) const; +public slots: void update(); private: + LocationInformationModel(QObject *obj = 0); int internalRowCount; }; -- cgit v1.2.3-70-g09d2