diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-07-01 18:46:27 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-01 19:21:23 -0700 |
commit | db8b140c52c7589a81f1e3d6d37ba48225525313 (patch) | |
tree | feef9c99d5205666c6791164d628df71a05b23df /qt-models/divelocationmodel.cpp | |
parent | 324b6182aa46fa8eb6c2c60c9fdcb40e00da6b32 (diff) | |
download | subsurface-db8b140c52c7589a81f1e3d6d37ba48225525313.tar.gz |
More information on dive site model
All of dive site information is now exposed to the model
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/divelocationmodel.cpp')
-rw-r--r-- | qt-models/divelocationmodel.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index e34e20a5d..53f518941 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -13,10 +13,15 @@ LocationInformationModel *LocationInformationModel::instance() return self; } -LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractListModel(obj), internalRowCount(0) +LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractTableModel(obj), internalRowCount(0) { } +int LocationInformationModel::columnCount(const QModelIndex &parent) const +{ + return COLUMNS; +} + int LocationInformationModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); @@ -33,8 +38,20 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons return QVariant(); switch(role) { - case Qt::DisplayRole : return qPrintable(ds->name); - case DIVE_SITE_UUID : return ds->uuid; + case Qt::DisplayRole : + switch(index.column()) { + case UUID: return ds->uuid; + case NAME: return ds->name; + case LATITUDE: return ds->latitude.udeg; + case LONGITUDE: return ds->longitude.udeg; + case COORDS: return "TODO"; + case DESCRIPTION: return ds->description; + case NOTES: return ds->name; + case TAXONOMY_1: return "TODO"; + case TAXONOMY_2: return "TODO"; + case TAXONOMY_3: return "TODO"; + } + break; } return QVariant(); |