mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-08 02:53:13 +02:00
Compare commits
2 Commits
1b8dc5f410
...
471d1f2538
| Author | SHA1 | Date | |
|---|---|---|---|
| 471d1f2538 | |||
| dc52105868 |
@@ -26,7 +26,7 @@
|
||||
#include "crossrefitem.h"
|
||||
#include "element.h"
|
||||
#include "elementtextitemgroup.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
@@ -1104,7 +1104,10 @@ void DynamicElementTextItem::updateLabel()
|
||||
void DynamicElementTextItem::conductorWasAdded(Conductor *conductor)
|
||||
{
|
||||
Q_UNUSED(conductor)
|
||||
QTimer::singleShot(100, this, [this]() {
|
||||
setPotentialConductor();
|
||||
conductorPropertiesChanged();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -158,6 +158,45 @@ void WiringListExport::toCsv()
|
||||
return;
|
||||
}
|
||||
|
||||
QSet<QString> 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<QString> 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;
|
||||
|
||||
Reference in New Issue
Block a user