Gui: modernize C++: return braced init list

This commit is contained in:
wmayer
2023-08-17 15:12:18 +02:00
committed by wwmayer
parent b2672abc06
commit fa8978ce99
58 changed files with 286 additions and 276 deletions

View File

@@ -250,7 +250,7 @@ public:
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override
{
if (role != Qt::EditRole && role != Qt::DisplayRole && role != Qt::UserRole)
return QVariant();
return {};
QVariant variant;
Info info = getInfo(index);
_data(info, index.row(), &variant, nullptr, role == Qt::UserRole);
@@ -491,7 +491,7 @@ public:
QModelIndex parent(const QModelIndex & index) const override {
if (!index.isValid())
return QModelIndex();
return {};
Info parentInfo = getInfo(index);
Info grandParentInfo = parentInfo;
@@ -524,7 +524,7 @@ public:
}
return QModelIndex();
return {};
}
// returns true if successful, false if 'element' identifies a Leaf
@@ -597,13 +597,13 @@ public:
QModelIndex index(int row, int column,
const QModelIndex & parent = QModelIndex()) const override {
if (row < 0)
return QModelIndex();
return {};
Info myParentInfoEncoded = Info::root;
// encode the parent's QModelIndex into an 'Info' structure
bool parentCanHaveChildren = modelIndexToParentInfo(parent, myParentInfoEncoded);
if (!parentCanHaveChildren) {
return QModelIndex();
return {};
}
return createIndex(row, column, infoId(myParentInfoEncoded));
}
@@ -695,7 +695,7 @@ QString ExpressionCompleter::pathFromIndex(const QModelIndex& index) const
{
auto m = model();
if (!m || !index.isValid())
return QString();
return {};
QString res;
auto parent = index;