Fix #159: reset unused-element highlight when elements become used again

ElementsCollectionModel::highlightUnusedElement() only ever painted the
currently-unused elements red; it never cleared the background of items
that were no longer unused. So when an element was re-added to a project
and saved, its red 'unused' highlight persisted until the model was
rebuilt from scratch.

Reset every item's background before re-applying the highlight to the
current unused set.
This commit is contained in:
ispyisail
2026-06-18 21:09:49 +12:00
parent 342ac3626d
commit 4625964bb1
@@ -538,6 +538,11 @@ QList<QETProject *> ElementsCollectionModel::project() const
*/
void ElementsCollectionModel::highlightUnusedElement()
{
//Reset the background of every item first, so elements that are no
//longer unused lose their previous red highlight (issue #159).
for (ElementCollectionItem *eci : items())
eci->setBackground(QBrush());
QList <ElementsLocation> unused;
foreach (QETProject *project, m_project_list)