mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-05-09 18:39:58 +02:00
Merge pull request #455 from Kellermorph/makro-fix
Fix Thumbnail in Makrotree
This commit is contained in:
@@ -179,7 +179,6 @@ QString FileElementCollectionItem::localName(const ElementsLocation &location)
|
|||||||
}
|
}
|
||||||
else if (isElement()) {
|
else if (isElement()) {
|
||||||
QString display_name = location.name();
|
QString display_name = location.name();
|
||||||
// Schneide die Endung .qetmak für die Anzeige ab
|
|
||||||
if (display_name.endsWith(".qetmak")) {
|
if (display_name.endsWith(".qetmak")) {
|
||||||
display_name.remove(".qetmak");
|
display_name.remove(".qetmak");
|
||||||
}
|
}
|
||||||
@@ -216,7 +215,7 @@ QString FileElementCollectionItem::collectionPath() const
|
|||||||
else if (m_path == QETApp::companyElementsDirN())
|
else if (m_path == QETApp::companyElementsDirN())
|
||||||
return "company://";
|
return "company://";
|
||||||
else if (m_path == macrosPath)
|
else if (m_path == macrosPath)
|
||||||
return "macros://"; // <-- NEU: Protokoll für Makros zuweisen
|
return "macros://"; //
|
||||||
else
|
else
|
||||||
return "custom://";
|
return "custom://";
|
||||||
}
|
}
|
||||||
@@ -296,9 +295,9 @@ 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())
|
||||||
@@ -315,8 +314,10 @@ void FileElementCollectionItem::setUpData()
|
|||||||
| 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());
|
||||||
|
} else {
|
||||||
|
// Parse standard element information for search
|
||||||
ElementsLocation loc(collectionPath());
|
ElementsLocation loc(collectionPath());
|
||||||
DiagramContext context = loc.elementInformations();
|
DiagramContext context = loc.elementInformations();
|
||||||
QStringList search_list;
|
QStringList search_list;
|
||||||
@@ -325,16 +326,17 @@ void FileElementCollectionItem::setUpData()
|
|||||||
search_list.append(localName(loc));
|
search_list.append(localName(loc));
|
||||||
setData(search_list.join(" "));
|
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,7 +351,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -357,11 +359,15 @@ void FileElementCollectionItem::setUpIcon()
|
|||||||
{
|
{
|
||||||
if (isDir()) {
|
if (isDir()) {
|
||||||
setIcon(QET::Icons::Folder);
|
setIcon(QET::Icons::Folder);
|
||||||
|
} else {
|
||||||
|
if (m_path.endsWith(".qetmak")) {
|
||||||
|
setIcon(QIcon());
|
||||||
} else {
|
} else {
|
||||||
ElementsLocation loc(collectionPath());
|
ElementsLocation loc(collectionPath());
|
||||||
setIcon(loc.icon());
|
setIcon(loc.icon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -246,9 +246,6 @@ void DiagramEventAddMacro::addMacro(QPointF final_pos)
|
|||||||
QDomElement cloned_node = diagram_node.cloneNode(true).toElement();
|
QDomElement cloned_node = diagram_node.cloneNode(true).toElement();
|
||||||
|
|
||||||
QPointF target_pos = final_pos;
|
QPointF target_pos = final_pos;
|
||||||
if (m_preview_item) {
|
|
||||||
target_pos += m_preview_item->offset();
|
|
||||||
}
|
|
||||||
|
|
||||||
DiagramContent pasted_content;
|
DiagramContent pasted_content;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user