mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
54d6c3f004
commit
38ba434966
3 changed files with 41 additions and 68 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue