mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-19 21:24:13 +02:00
Highlight reset: only clear the red unused-highlight
Per review (plc-user): scope the reset to items currently painted with the red Dense4Pattern instead of clearing every item's background. This avoids clobbering other backgrounds (e.g. the amber "show this dir" highlight) and skips needless item updates on large collections.
This commit is contained in:
@@ -538,10 +538,15 @@ 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).
|
||||
//Reset only the items currently highlighted in red, so elements that
|
||||
//are no longer unused lose the highlight. Scoping to the red
|
||||
//Dense4Pattern avoids touching other backgrounds (e.g. the amber
|
||||
//"show this dir" highlight) and avoids needless updates on big
|
||||
//collections (issue #159).
|
||||
for (ElementCollectionItem *eci : items())
|
||||
eci->setBackground(QBrush());
|
||||
if (eci->background().style() == Qt::Dense4Pattern &&
|
||||
eci->background().color() == Qt::red)
|
||||
eci->setBackground(QBrush());
|
||||
|
||||
QList <ElementsLocation> unused;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user