From 8e2a29deafb8807a2bd4dc55166d31f5c1ae1e3c Mon Sep 17 00:00:00 2001 From: ispyisail Date: Mon, 21 Sep 2026 21:24:14 +1200 Subject: [PATCH] Update the database row once an auto-numbered conductor has its number ConductorCreator inserts a conductor and only afterwards calls refreshText(), which resolves the auto-numbering formula into properties.text. The project database inserted its row while text was still the raw formula, and refreshText() writes the resolved text without emitting propertiesChange -- the signal the database listens for -- so nothing corrects the row. Measured: with a conductor auto-numbering "W%sequ_1" selected, two wired conductors read W1 and W2 on the live objects and in the saved file, but "W%sequ_1" and "W%sequ_1" in conductor.text and in wiring_list_view.wire_number. A full updateDB() corrects it, so the data was right and only the cache was stale. Anything that reads the database between creating a conductor and the next rebuild -- the wiring list, a BOM export, a custom query -- sees the formula, not the number. Update the row after refreshText(). The row change deliberately emits no dataBaseUpdated(), as updateConductor() already documents, so this adds no model re-queries. Co-Authored-By: Claude Sonnet 5 --- sources/utils/conductorcreator.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sources/utils/conductorcreator.cpp b/sources/utils/conductorcreator.cpp index 4a0ce5a37..77f2009ec 100644 --- a/sources/utils/conductorcreator.cpp +++ b/sources/utils/conductorcreator.cpp @@ -18,7 +18,9 @@ #include "conductorcreator.h" #include "../conductorautonumerotation.h" +#include "../dataBase/projectdatabase.h" #include "../diagram.h" +#include "../qetproject.h" #include "../undocommand/addgraphicsobjectcommand.h" #include "../qetgraphicsitem/conductor.h" #include "../qetgraphicsitem/element.h" @@ -68,6 +70,15 @@ ConductorCreator::ConductorCreator(Diagram *d, QList terminals_list) for(Conductor *c : c_list) { c->refreshText(); + //refreshText() resolves an auto-numbering formula into + //properties.text without emitting propertiesChange, which is + //what the project database listens to. The row was inserted + //while text was still the raw formula ("W%sequ_1"), so without + //this the wiring list and BOM read the formula, not "W1", + //until something forces a full rebuild. + if (d->project() && d->project()->dataBase()) { + d->project()->dataBase()->updateConductor(c); + } } }