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:
blacksun
2016-06-30 09:12:25 +00:00
parent 62c2806e31
commit 438ce78c4f
11 changed files with 240 additions and 93 deletions

View File

@@ -815,7 +815,8 @@ QString QETProject::integrateTitleBlockTemplate(const TitleBlockTemplateLocation
@return true si l'element location est utilise sur au moins un des schemas
de ce projet, false sinon
*/
bool QETProject::usesElement(const ElementsLocation &location) {
bool QETProject::usesElement(const ElementsLocation &location) const
{
foreach(Diagram *diagram, diagrams()) {
if (diagram -> usesElement(location)) {
return(true);
@@ -824,6 +825,24 @@ bool QETProject::usesElement(const ElementsLocation &location) {
return(false);
}
/**
* @brief QETProject::unusedElements
* @return the list of unused element (exactly her location)
* An unused element, is an element present in the embedded collection but not present in a diagram of this project.
* Be aware that an element can be not present in a diagram,
* but managed by an undo command (delete an element), so an unused element can be used after an undo.
*/
QList<ElementsLocation> QETProject::unusedElements() const
{
QList <ElementsLocation> unused_list;
foreach(ElementsLocation location, m_elements_collection->elementsLocation())
if (location.isElement() && !usesElement(location))
unused_list << location;
return unused_list;
}
/**
@param location Location of a title block template
@return true if the provided template is used by at least one diagram