mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-19 12:44:13 +02:00
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:
@@ -538,6 +538,11 @@ QList<QETProject *> ElementsCollectionModel::project() const
|
|||||||
*/
|
*/
|
||||||
void ElementsCollectionModel::highlightUnusedElement()
|
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;
|
QList <ElementsLocation> unused;
|
||||||
|
|
||||||
foreach (QETProject *project, m_project_list)
|
foreach (QETProject *project, m_project_list)
|
||||||
|
|||||||
Reference in New Issue
Block a user