diff options
-rw-r--r-- | desktop-widgets/modeldelegates.cpp | 6 | ||||
-rw-r--r-- | qt-models/weightmodel.cpp | 6 | ||||
-rw-r--r-- | qt-models/weightmodel.h | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 770a828cd..6d5d9f9a4 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -371,9 +371,9 @@ QWidget *WSInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewIte /* First, call the combobox-create editor, it will setup our globals. */ QWidget *editor = ComboBoxDelegate::createEditor(parent, option, index); WeightModel *mymodel = qobject_cast<WeightModel *>(currCombo.model); - weightsystem_t *ws = mymodel->weightSystemAt(index); - currWeight.type = ws->description; - currWeight.weight = ws->weight.grams; + weightsystem_t ws = mymodel->weightSystemAt(index); + currWeight.type = ws.description; + currWeight.weight = ws.weight.grams; return editor; } diff --git a/qt-models/weightmodel.cpp b/qt-models/weightmodel.cpp index ff0b5c87a..4a931a4bb 100644 --- a/qt-models/weightmodel.cpp +++ b/qt-models/weightmodel.cpp @@ -19,14 +19,14 @@ WeightModel::WeightModel(QObject *parent) : CleanerTableModel(parent), connect(&diveListNotifier, &DiveListNotifier::weightRemoved, this, &WeightModel::weightRemoved); } -weightsystem_t *WeightModel::weightSystemAt(const QModelIndex &index) +weightsystem_t WeightModel::weightSystemAt(const QModelIndex &index) { int row = index.row(); if (row < 0 || row >= d->weightsystems.nr) { qWarning("WeightModel: Accessing invalid weightsystem %d (of %d)", row, d->weightsystems.nr); - return nullptr; + return { { 0 }, nullptr }; } - return &d->weightsystems.weightsystems[index.row()]; + return d->weightsystems.weightsystems[index.row()]; } void WeightModel::clear() diff --git a/qt-models/weightmodel.h b/qt-models/weightmodel.h index a61217379..2e5a190ba 100644 --- a/qt-models/weightmodel.h +++ b/qt-models/weightmodel.h @@ -25,7 +25,7 @@ public: void passInData(const QModelIndex &index, const QVariant &value); void clear(); void updateDive(dive *d); - weightsystem_t *weightSystemAt(const QModelIndex &index); + weightsystem_t weightSystemAt(const QModelIndex &index); bool changed; public |