diff --git a/sources/ElementsCollection/fileelementcollectionitem.cpp b/sources/ElementsCollection/fileelementcollectionitem.cpp index 1c8dc410b..7b9d3ea98 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.cpp +++ b/sources/ElementsCollection/fileelementcollectionitem.cpp @@ -480,6 +480,22 @@ void FileElementCollectionItem::setUpIcon() } } +/** + @brief FileElementCollectionItem::clearData + Reset the data, and let setUpIcon() build the icon again. + Without this the guard in setUpIcon() keeps the icon cleared here + empty until the whole collection is reloaded, e.g. after an element + is saved from the element editor (see locationWasSaved()). +*/ +void FileElementCollectionItem::clearData() +{ + // Reset the flag only after the base class has cleared the icon: + // its setIcon() emits dataChanged(), which re-enters setUpIcon(), + // and that call must still see the flag set and return early. + ElementCollectionItem::clearData(); + m_icon_initialized = false; +} + /** @brief FileElementCollectionItem::setPathName Set the name of this item in the file system path. diff --git a/sources/ElementsCollection/fileelementcollectionitem.h b/sources/ElementsCollection/fileelementcollectionitem.h index 6cb78aa08..68cc6d5ba 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.h +++ b/sources/ElementsCollection/fileelementcollectionitem.h @@ -55,6 +55,7 @@ class FileElementCollectionItem : public ElementCollectionItem void setUpData() override; void setUpIcon() override; + void clearData() override; private: void setPathName(const QString& path_name,