From dc52105868dda41302ad458ab42aa2b4a2d6e8de Mon Sep 17 00:00:00 2001 From: Kellermorph Date: Tue, 26 May 2026 18:31:37 +0200 Subject: [PATCH] Fix: Wiring list filter and dynamic text timing --- .../dynamicelementtextitem.cpp | 7 ++- sources/wiringlistexport.cpp | 43 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index 4c23cb2a4..64a05d603 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -26,7 +26,7 @@ #include "crossrefitem.h" #include "element.h" #include "elementtextitemgroup.h" - +#include #include #include #include @@ -1104,7 +1104,10 @@ void DynamicElementTextItem::updateLabel() void DynamicElementTextItem::conductorWasAdded(Conductor *conductor) { Q_UNUSED(conductor) - setPotentialConductor(); + QTimer::singleShot(100, this, [this]() { + setPotentialConductor(); + conductorPropertiesChanged(); + }); } /** diff --git a/sources/wiringlistexport.cpp b/sources/wiringlistexport.cpp index f84538887..77b8d0d74 100644 --- a/sources/wiringlistexport.cpp +++ b/sources/wiringlistexport.cpp @@ -158,6 +158,45 @@ void WiringListExport::toCsv() return; } + QSet conductorDefinitionTypes; + QDomElement rootElem = doc.documentElement(); + QDomElement collection = rootElem.firstChildElement("collection"); + if (!collection.isNull()) { + QDomNodeList defs = collection.elementsByTagName("definition"); + for (int i = 0; i < defs.size(); ++i) { + QDomElement def = defs.at(i).toElement(); + if (def.attribute("link_type") == "conductor_definition") { + QDomElement parentEl = def.parentNode().toElement(); + if (parentEl.tagName().toLower() == "element") { + QString name = parentEl.attribute("name"); + if (!name.isEmpty()) { + conductorDefinitionTypes.insert(name); + } + } + } + } + } + + QSet conductorDefinitionUuids; + QDomNodeList projectElements = rootElem.elementsByTagName("element"); + for (int i = 0; i < projectElements.size(); ++i) { + QDomElement el = projectElements.at(i).toElement(); + QString typeVal = el.attribute("type"); + bool isCondDef = false; + for (const QString &cType : conductorDefinitionTypes) { + if (typeVal.endsWith(cType)) { + isCondDef = true; + break; + } + } + if (isCondDef) { + QString uuid = normalizeUuid(el.attribute("uuid", el.attribute("id", ""))); + if (!uuid.isEmpty()) { + conductorDefinitionUuids.insert(uuid); + } + } + } + QFileDialog dialog(m_parent); dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setWindowTitle(tr("Exporter le plan de câblage")); @@ -200,6 +239,10 @@ void WiringListExport::toCsv() for (int i = 0; i < conductors.size(); ++i) { ConductorData c = conductors[i]; + if (conductorDefinitionUuids.contains(c.el1_uuid) || conductorDefinitionUuids.contains(c.el2_uuid)) { + continue; + } + if (c.element1_label.isEmpty() && elementsInfo.contains(c.el1_uuid)) { c.element1_label = elementsInfo[c.el1_uuid].label; if (c.element1_label.isEmpty()) c.element1_label = elementsInfo[c.el1_uuid].name;