mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
element collection widget : highlight unused element in a project.
the feature "clean project" does not clean unused elements yet git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4561 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -341,6 +341,32 @@ QList<QETProject *> ElementsCollectionModel::project() const
|
||||
return m_project_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::highlightUnusedElement
|
||||
* Highlight every unused element of managed project.
|
||||
* @See QETProject::unusedElements()
|
||||
*/
|
||||
void ElementsCollectionModel::highlightUnusedElement()
|
||||
{
|
||||
QList <ElementsLocation> unused;
|
||||
|
||||
foreach (QETProject *project, m_project_list)
|
||||
unused.append(project->unusedElements());
|
||||
|
||||
QBrush brush;
|
||||
brush.setStyle(Qt::Dense4Pattern);
|
||||
brush.setColor(Qt::red);
|
||||
|
||||
foreach (ElementsLocation location, unused) {
|
||||
QModelIndex index = indexFromLocation(location);
|
||||
if (index.isValid()) {
|
||||
QStandardItem *qsi = itemFromIndex(index);
|
||||
if (qsi)
|
||||
qsi->setBackground(brush);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsCollectionModel::items
|
||||
* @return every ElementCollectionItem owned by this model
|
||||
|
||||
Reference in New Issue
Block a user