diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-08-31 20:59:13 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-31 18:42:15 -0700 |
commit | a3d6098c8ce7bee6841872153a85b573d583430d (patch) | |
tree | 995fb9fdd1002f72ec30bdf9f0f1fbf79b26aea3 /qt-models | |
parent | dcda950202545f0ecbe6a1192ec5aaae4af19227 (diff) | |
download | subsurface-a3d6098c8ce7bee6841872153a85b573d583430d.tar.gz |
Display dive sites with same gps as the current
So we can merge them later - currently we are showing
only the ID, ugly - fixing next.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divelocationmodel.cpp | 9 | ||||
-rw-r--r-- | qt-models/divelocationmodel.h | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index abdf69f91..ff733f5ad 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -188,8 +188,13 @@ bool filter_same_gps_cb (QAbstractItemModel *model, int sourceRow, const QModelI { int ref_lat = displayed_dive_site.latitude.udeg; int ref_lon = displayed_dive_site.longitude.udeg; - QModelIndex curr = model->index(sourceRow, LocationInformationModel::UUID, parent.isValid() ? parent : QModelIndex()); + QSortFilterProxyModel *self = (QSortFilterProxyModel*) model; + + int ds_uuid = self->sourceModel()->index(sourceRow, LocationInformationModel::UUID, parent).data().toInt(); + struct dive_site *ds = get_dive_site_by_uuid(ds_uuid); + + if (!ds) + return false; - struct dive_site *ds = get_dive_site_by_uuid(curr.data().toInt()); return (ds->latitude.udeg == ref_lat && ds->longitude.udeg == ref_lon); }
\ No newline at end of file diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h index f40bbd1de..83bc97e67 100644 --- a/qt-models/divelocationmodel.h +++ b/qt-models/divelocationmodel.h @@ -11,7 +11,7 @@ class QLineEdit; #define RECENTLY_ADDED_DIVESITE 1 -bool filter_same_gps_cb (int sourceRow, const QModelIndex& parent); +bool filter_same_gps_cb (QAbstractItemModel *m, int sourceRow, const QModelIndex& parent); class LocationInformationModel : public QAbstractTableModel { Q_OBJECT |