From 80fe3f88f92c55400afe87092ef02492f7bafac2 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 29 May 2015 23:15:12 -0300 Subject: Correctly set the dive site id on the dive When changing the index of the combobox we were discarting the dive_site_id. This fixes it. Now I need to understand what's happening to the globe. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-models/divelocationmodel.cpp | 1 + qt-models/divelocationmodel.h | 1 + qt-ui/maintab.cpp | 3 +++ 3 files changed, 5 insertions(+) diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index 973452b16..164d85d95 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -25,6 +25,7 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons switch(role) { case Qt::DisplayRole : return qPrintable(ds->name); + case DIVE_SITE_UUID : return ds->uuid; } return QVariant(); diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h index ee5f3c362..9238c4b5b 100644 --- a/qt-models/divelocationmodel.h +++ b/qt-models/divelocationmodel.h @@ -6,6 +6,7 @@ class LocationInformationModel : public QAbstractListModel { Q_OBJECT public: + enum { DIVE_SITE_UUID = Qt::UserRole+1}; static LocationInformationModel *instance(); int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index = QModelIndex(), int role = Qt::DisplayRole) const; diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 01c342ad6..f344b1b82 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1270,6 +1270,9 @@ void MainTab::on_location_currentTextChanged(const QString &text) } if (current_dive && text == QString(get_dive_site_by_uuid(current_dive->dive_site_uuid)->name)) return; + + uint32_t uuid = ui.location->currentData(LocationInformationModel::DIVE_SITE_UUID).toInt(); + displayed_dive.dive_site_uuid = uuid; markChangedWidget(ui.location); } -- cgit v1.2.3-70-g09d2