mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-03 09:14:12 +02:00
Merge pull request #1120 from ispyisail/fix/1117-collection-icon-after-save
Fix #1117: element icon disappears from the collection after saving
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -55,6 +55,7 @@ class FileElementCollectionItem : public ElementCollectionItem
|
||||
|
||||
void setUpData() override;
|
||||
void setUpIcon() override;
|
||||
void clearData() override;
|
||||
|
||||
private:
|
||||
void setPathName(const QString& path_name,
|
||||
|
||||
Reference in New Issue
Block a user