Change a wire's properties by uuid without building its folios (stage D5)

Scripts get conductorPropertyByUuid() and setConductorPropertyByUuid(),
the wire named by its uuid (conductorUuids()) rather than by a symbol's
terminal. A change goes to every wire at the wire's potential, as
setConductorProperty() does. When those wires are all on folios not
built, none is numbered by a formula, and what changes in each is what a
.qetz database holds in its own columns (number, function, voltage,
colour and section of the wire, cable, bus), it goes through the project
database: the store and the conductor rows, undoable by uuid. The
potential is followed in the database (projectDataBase::potentialWires():
through wire ends, folio reports and terminal blocks, as
Conductor::relatedPotentialConductors() follows it; a terminal block that
isolates its terminals answers nothing). Building a wire takes its change
(Conductor::fromXml()); a .qetz save writes it in the database, the folio
file copied; a folio written from its XML gets it there; a .qet builds.
Anything else builds the folio, as before.

tst_lazyfolios: every wire's potential from the database = as followed,
1 342 of 1 342 (industrial, eager and from a .qetz); a cable set by uuid
on a 14-wire potential builds no folio, reaches every wire, saves as when
built, undoes, shows once built (fails when building ignores the change,
and when the .qetz writer does). The test's run limit is raised (500 s ->
1 500 s, ctest 1 800 s): under load it ran past 500 s. ctest 96/96 both
ways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-12 23:26:39 +13:00
parent b8390c853c
commit 798010cc83
10 changed files with 507 additions and 2 deletions
+21
View File
@@ -2512,6 +2512,17 @@ QDomDocument QETProject::toXml(QHash<int, QByteArray> *kept_folios, QStringList
const QDomElement old_information = element.firstChildElement(QStringLiteral("elementInformations"));
element.replaceChild(information, old_information); //it has one (unbuiltEditsOnFolio())
}
//Its wires whose properties changed
const QHash<QUuid, ConductorProperties> wire_edits = m_data_base.unbuiltWireEditsOnFolio(diagram->uuid());
if (!wire_edits.isEmpty())
for (const QDomElement &list : QET::findInDomElement(xml_diagram, QStringLiteral("conductors")))
for (QDomElement wire = list.firstChildElement(QStringLiteral("conductor")) ; !wire.isNull() ;
wire = wire.nextSiblingElement(QStringLiteral("conductor"))) {
const auto edit = wire_edits.constFind(QUuid(wire.attribute(QStringLiteral("uuid"))));
if (edit == wire_edits.constEnd()) continue;
for (const auto &attribute : edit->attributes())
wire.setAttribute(attribute.first, attribute.second);
}
xml_diagram.setAttribute("order", order_num ++);
project_root.appendChild(xml_diagram);
continue;
@@ -2530,6 +2541,16 @@ QDomDocument QETProject::toXml(QHash<int, QByteArray> *kept_folios, QStringList
it.value().toXml(information, QStringLiteral("elementInformation"));
symbol.appendChild(information);
placeholder.appendChild(symbol);
}
//Its wires whose properties changed: what the .qetz database
//holds of them (only that can change, QetScriptApi)
const QHash<QUuid, ConductorProperties> wire_edits = m_data_base.unbuiltWireEditsOnFolio(diagram->uuid());
for (auto it = wire_edits.cbegin() ; it != wire_edits.cend() ; ++it) {
auto wire = xml_doc.createElement(QStringLiteral("qetz-edited-conductor"));
wire.setAttribute(QStringLiteral("uuid"), it.key().toString());
for (const auto &attribute : it.value().attributes())
wire.setAttribute(attribute.first, attribute.second);
placeholder.appendChild(wire);
}
kept_parts->append(diagram->deferredPart());
project_root.appendChild(placeholder);