mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b0d7d0f3b9
commit
80fe3f88f9
3 changed files with 5 additions and 0 deletions
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue