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.
Noticed that my Dolphin spent 4 ms on startup in KItemListView::slotItemsChanged
because it thought every single item's "iconOverlays"
had changed. With this change, it is around half a millisecond and genuinely only called for files with overlays (e.g. inaccessible ones with "emblem-locked"
)
Edited by Kai Uwe Broulik