diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-06-08 08:49:12 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-06-19 13:11:10 -0700 |
commit | 38ba434966409987e5dfb894c27c8c03168cfdc6 (patch) | |
tree | e9e4d9721ada0f3c2040f49e3c062b49ba6824e0 /qt-models/cleanertablemodel.cpp | |
parent | 54d6c3f004f27a813f4b0adf48927aca5cb79cd1 (diff) | |
download | subsurface-38ba434966409987e5dfb894c27c8c03168cfdc6.tar.gz |
Cleanup: return directly from data() methods
There is this anti-pattern in QModel data() functions to assign
to a "ret" variable and return at the end of the function. This
is inefficient, as the object is not directly constructed at
the space reserved by the caller.
Change the functions in WeightModel and CylinderModel to return
the objects directly.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/cleanertablemodel.cpp')
-rw-r--r-- | qt-models/cleanertablemodel.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/qt-models/cleanertablemodel.cpp b/qt-models/cleanertablemodel.cpp index 36b0f4e76..fc4e93b16 100644 --- a/qt-models/cleanertablemodel.cpp +++ b/qt-models/cleanertablemodel.cpp @@ -31,19 +31,16 @@ int CleanerTableModel::columnCount(const QModelIndex&) const QVariant CleanerTableModel::headerData(int section, Qt::Orientation orientation, int role) const { - QVariant ret; - if (orientation == Qt::Vertical) - return ret; + return QVariant(); switch (role) { case Qt::FontRole: - ret = defaultModelFont(); - break; + return defaultModelFont(); case Qt::DisplayRole: - ret = headers.at(section); + return headers.at(section); } - return ret; + return QVariant(); } void CleanerTableModel::setHeaderDataStrings(const QStringList &newHeaders) |