Element panel : elements can be searched by their name but also with by all their informations.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5698 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2019-01-04 22:06:34 +00:00
parent d735983c16
commit 58ef54090e
7 changed files with 66 additions and 18 deletions

View File

@@ -240,7 +240,20 @@ void FileElementCollectionItem::setUpData()
if (isDir())
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
else
{
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
//Set the local name and all informations of the element
//in the data Qt::UserRole+1, these data will be use for search.
ElementsLocation location(collectionPath());
DiagramContext context = location.elementInformations();
QStringList search_list;
for (QString key : context.keys()) {
search_list.append(context.value(key).toString());
}
search_list.append(localName());
setData(search_list.join(" "));
}
setToolTip(collectionPath());
}