Commit fac08af0 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Don't include `iconOverlays` in rolesData if it is empty

If this role isn't in the model yet, it would be `QVariant::Invalid`
which is obviously a distinct type from an empty string list.

This means `KFileItemModel::setData` treats them non-equal and
potentially does expensive operations on the model, which is
called every time a role is resolved in `KFileItemModelRolesUpdater`.

With this change, the number of pointless layout calculations is
significantly reduced.
parent f45d2e98
Pipeline #219387 passed with stage
in 7 minutes and 13 seconds
......@@ -1350,7 +1350,9 @@ QHash<QByteArray, QVariant> KFileItemModelRolesUpdater::rolesData(const KFileIte
for (KOverlayIconPlugin *it : qAsConst(m_overlayIconsPlugin)) {
overlays.append(it->getOverlays(item.url()));
}
data.insert("iconOverlays", overlays);
if (!overlays.isEmpty()) {
data.insert("iconOverlays", overlays);
}
#if HAVE_BALOO
if (m_balooFileMonitor) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment