mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
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.
This commit is contained in:
parent
f45d2e9854
commit
fac08af081
|
@ -1350,7 +1350,9 @@ QHash<QByteArray, QVariant> KFileItemModelRolesUpdater::rolesData(const KFileIte
|
||||||
for (KOverlayIconPlugin *it : qAsConst(m_overlayIconsPlugin)) {
|
for (KOverlayIconPlugin *it : qAsConst(m_overlayIconsPlugin)) {
|
||||||
overlays.append(it->getOverlays(item.url()));
|
overlays.append(it->getOverlays(item.url()));
|
||||||
}
|
}
|
||||||
data.insert("iconOverlays", overlays);
|
if (!overlays.isEmpty()) {
|
||||||
|
data.insert("iconOverlays", overlays);
|
||||||
|
}
|
||||||
|
|
||||||
#if HAVE_BALOO
|
#if HAVE_BALOO
|
||||||
if (m_balooFileMonitor) {
|
if (m_balooFileMonitor) {
|
||||||
|
|
Loading…
Reference in a new issue