mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-08 11:13:15 +02:00
Compare commits
2 Commits
1b8dc5f410
...
471d1f2538
| Author | SHA1 | Date | |
|---|---|---|---|
| 471d1f2538 | |||
| dc52105868 |
@@ -26,7 +26,7 @@
|
|||||||
#include "crossrefitem.h"
|
#include "crossrefitem.h"
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
#include "elementtextitemgroup.h"
|
#include "elementtextitemgroup.h"
|
||||||
|
#include <QTimer>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
@@ -1104,7 +1104,10 @@ void DynamicElementTextItem::updateLabel()
|
|||||||
void DynamicElementTextItem::conductorWasAdded(Conductor *conductor)
|
void DynamicElementTextItem::conductorWasAdded(Conductor *conductor)
|
||||||
{
|
{
|
||||||
Q_UNUSED(conductor)
|
Q_UNUSED(conductor)
|
||||||
|
QTimer::singleShot(100, this, [this]() {
|
||||||
setPotentialConductor();
|
setPotentialConductor();
|
||||||
|
conductorPropertiesChanged();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -158,6 +158,45 @@ void WiringListExport::toCsv()
|
|||||||
return;
|
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);
|
QFileDialog dialog(m_parent);
|
||||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
dialog.setWindowTitle(tr("Exporter le plan de câblage"));
|
dialog.setWindowTitle(tr("Exporter le plan de câblage"));
|
||||||
@@ -200,6 +239,10 @@ void WiringListExport::toCsv()
|
|||||||
for (int i = 0; i < conductors.size(); ++i) {
|
for (int i = 0; i < conductors.size(); ++i) {
|
||||||
ConductorData c = conductors[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)) {
|
if (c.element1_label.isEmpty() && elementsInfo.contains(c.el1_uuid)) {
|
||||||
c.element1_label = elementsInfo[c.el1_uuid].label;
|
c.element1_label = elementsInfo[c.el1_uuid].label;
|
||||||
if (c.element1_label.isEmpty()) c.element1_label = elementsInfo[c.el1_uuid].name;
|
if (c.element1_label.isEmpty()) c.element1_label = elementsInfo[c.el1_uuid].name;
|
||||||
|
|||||||
Reference in New Issue
Block a user