summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-24 16:34:43 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commitab29f6416b619c141de979b82dde24cee4d5cb1b (patch)
tree1786b6dab3bd7b0c2e4b9517bc09b2c8b145cedc /qt-models
parentd674c5028f45a5c3bc67a2aafa637c798c3874f0 (diff)
downloadsubsurface-ab29f6416b619c141de979b82dde24cee4d5cb1b.tar.gz
Dive site: replace UUID_ROLE by DIVESITE_ROLE
Access to dive-sites in the LocationInformationModel was via UUID. Replace this by a direct access to the struct dive_site pointer. Accordingly, rename the UUID_ROLE to DIVESITE_ROLE. This is a small step in replacing dive-site UUIDs by pointers throughout the code base. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divelocationmodel.cpp4
-rw-r--r--qt-models/divelocationmodel.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index 43ab8eac7..c1a7308f4 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -59,8 +59,8 @@ QVariant LocationInformationModel::getDiveSiteData(const struct dive_site *ds, i
else
return QVariant();
}
- case UUID_ROLE:
- return ds->uuid;
+ case DIVESITE_ROLE:
+ return QVariant::fromValue<void *>((void *)ds); // Not nice: casting away const
}
return QVariant();
}
diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h
index 14077609c..5f95d5975 100644
--- a/qt-models/divelocationmodel.h
+++ b/qt-models/divelocationmodel.h
@@ -16,7 +16,7 @@ public:
// Common columns, roles and accessor function for all dive-site models.
// Thus, different views can connect to different models.
enum Columns { UUID, NAME, LATITUDE, LONGITUDE, COORDS, DESCRIPTION, NOTES, TAXONOMY_1, TAXONOMY_2, TAXONOMY_3, COLUMNS};
- enum Roles { UUID_ROLE = Qt::UserRole + 1 };
+ enum Roles { DIVESITE_ROLE = Qt::UserRole + 1 };
static QVariant getDiveSiteData(const struct dive_site *ds, int column, int role);
LocationInformationModel(QObject *obj = 0);