summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-06 22:16:37 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-07 08:46:15 -0700
commit2ff459c35691f1548cc8a587cd437f5215f8ccc1 (patch)
treecec0a7329a64fed1aec3c3fb35a5245087420adf
parent6790e07a4cf03b02ea2163dd4a55ff5bcf04f834 (diff)
downloadsubsurface-2ff459c35691f1548cc8a587cd437f5215f8ccc1.tar.gz
cleanup: return directly in ExtraDataModel::data()
Instead of assigning to a ret variable and returning at the end of the function, return directly from the various switch branches. This is more idiomatic and consistent with the other models. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--qt-models/divecomputerextradatamodel.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/qt-models/divecomputerextradatamodel.cpp b/qt-models/divecomputerextradatamodel.cpp
index 2b2710f95..e322a70a8 100644
--- a/qt-models/divecomputerextradatamodel.cpp
+++ b/qt-models/divecomputerextradatamodel.cpp
@@ -20,33 +20,28 @@ void ExtraDataModel::clear()
QVariant ExtraDataModel::data(const QModelIndex &index, int role) const
{
- QVariant ret;
struct extra_data *ed = get_dive_dc(&displayed_dive, dc_number)->extra_data;
int i = -1;
while (ed && ++i < index.row())
ed = ed->next;
if (!ed)
- return ret;
+ return QVariant();
switch (role) {
case Qt::FontRole:
- ret = defaultModelFont();
- break;
+ return defaultModelFont();
case Qt::TextAlignmentRole:
- ret = int(Qt::AlignLeft | Qt::AlignVCenter);
- break;
+ return static_cast<int>(Qt::AlignLeft | Qt::AlignVCenter);
case Qt::DisplayRole:
switch (index.column()) {
case KEY:
- ret = QString(ed->key);
- break;
+ return ed->key;
case VALUE:
- ret = QString(ed->value);
- break;
+ return ed->value;
}
- break;
+ return QVariant();
}
- return ret;
+ return QVariant();
}
int ExtraDataModel::rowCount(const QModelIndex&) const