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 <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-05-29 22:22:24 -03:00 committed by Dirk Hohndel
parent d6e61b74fc
commit ac6a7ab24e
5 changed files with 25 additions and 4 deletions

View file

@ -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)
{
}

View file

@ -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;
};