mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-05-19 02:59:59 +02:00
Fix Thumbnail in Makrotree
This commit is contained in:
@@ -296,45 +296,48 @@ void FileElementCollectionItem::addChildAtPath(const QString &collection_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief FileElementCollectionItem::setUpData
|
* @brief FileElementCollectionItem::setUpData
|
||||||
SetUp the data of this item
|
* SetUp the data of this item
|
||||||
*/
|
*/
|
||||||
void FileElementCollectionItem::setUpData()
|
void FileElementCollectionItem::setUpData()
|
||||||
{
|
{
|
||||||
if (isDir())
|
if (isDir())
|
||||||
{
|
{
|
||||||
localName();
|
localName();
|
||||||
setFlags(Qt::ItemIsSelectable
|
setFlags(Qt::ItemIsSelectable
|
||||||
| Qt::ItemIsDragEnabled
|
| Qt::ItemIsDragEnabled
|
||||||
| Qt::ItemIsDropEnabled
|
| Qt::ItemIsDropEnabled
|
||||||
| Qt::ItemIsEnabled);
|
| Qt::ItemIsEnabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setFlags(Qt::ItemIsSelectable
|
setFlags(Qt::ItemIsSelectable
|
||||||
| Qt::ItemIsDragEnabled
|
| Qt::ItemIsDragEnabled
|
||||||
| Qt::ItemIsEnabled);
|
| Qt::ItemIsEnabled);
|
||||||
|
|
||||||
//Set the local name and all informations of the element
|
if (m_path.endsWith(".qetmak")) {
|
||||||
//in the data Qt::UserRole+1, these data will be use for search.
|
setData(localName());
|
||||||
ElementsLocation loc(collectionPath());
|
} else {
|
||||||
DiagramContext context = loc.elementInformations();
|
// Parse standard element information for search
|
||||||
QStringList search_list;
|
ElementsLocation loc(collectionPath());
|
||||||
for (QString& key : context.keys())
|
DiagramContext context = loc.elementInformations();
|
||||||
{ search_list.append(context.value(key).toString()); }
|
QStringList search_list;
|
||||||
search_list.append(localName(loc));
|
for (QString& key : context.keys())
|
||||||
setData(search_list.join(" "));
|
{ search_list.append(context.value(key).toString()); }
|
||||||
|
search_list.append(localName(loc));
|
||||||
|
setData(search_list.join(" "));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setToolTip(collectionPath());
|
setToolTip(collectionPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief FileElementCollectionItem::setUpIcon
|
* @brief FileElementCollectionItem::setUpIcon
|
||||||
SetUp the icon of this item.
|
* SetUp the icon of this item.
|
||||||
Because icon use several memory,
|
* Because icon use several memory,
|
||||||
we use this method for setup icon instead setUpData.
|
* we use this method for setup icon instead setUpData.
|
||||||
*/
|
*/
|
||||||
void FileElementCollectionItem::setUpIcon()
|
void FileElementCollectionItem::setUpIcon()
|
||||||
{
|
{
|
||||||
if (!icon().isNull())
|
if (!icon().isNull())
|
||||||
@@ -349,17 +352,21 @@ void FileElementCollectionItem::setUpIcon()
|
|||||||
else if (m_path == QETApp::companyElementsDirN())
|
else if (m_path == QETApp::companyElementsDirN())
|
||||||
setIcon(QIcon(":/ico/16x16/go-company.png"));
|
setIcon(QIcon(":/ico/16x16/go-company.png"));
|
||||||
else if (m_path == macrosPath)
|
else if (m_path == macrosPath)
|
||||||
setIcon(QIcon(":/ico/16x16/go-home.png")); // <-- NEU: Icon für Makros (z.B. go-home)
|
setIcon(QIcon(":/ico/16x16/go-home.png"));
|
||||||
else
|
else
|
||||||
setIcon(QIcon(":/ico/16x16/go-home.png"));
|
setIcon(QIcon(":/ico/16x16/go-home.png"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isDir()) {
|
if (isDir()) {
|
||||||
setIcon(QET::Icons::Folder);
|
setIcon(QET::Icons::Folder);
|
||||||
} else {
|
} else {
|
||||||
ElementsLocation loc(collectionPath());
|
if (m_path.endsWith(".qetmak")) {
|
||||||
setIcon(loc.icon());
|
setIcon(QIcon());
|
||||||
|
} else {
|
||||||
|
ElementsLocation loc(collectionPath());
|
||||||
|
setIcon(loc.icon());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user