From 6225b20f32d76bdfdf1653b09fa9721f81c10a24 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Tue, 20 Oct 2026 17:40:14 +1300 Subject: [PATCH] Populate folio_counter rows from the document, not just write-through Habit 4: a folio that is only parsed, never built into a live Diagram scene by a numbering edit, still needs its folio_counter rows. Diagram::folioSequentialsFromXml() now writes the rows it just parsed, the same way insertFolioSeqHash() does for an edit made in a built scene. Adds the fixture used to prove this: folio_counters_multi.qet, 3 folios, an element and a conductor numbering scheme both using a tenfolio part, exercising insertFolioSeqHash()'s write-through and this load-time path. Resave-of-resave is byte-identical; ctest clean on the 4 directly relevant tests. Found in passing, not fixed here (pre-existing on master, outside 2b-4's scope): the conductor side's folio-sequential XML ends up saved under instead of its own tag -- the fixture's 'Wires' scheme reads back with owner=element for exactly that reason. Worth a FINDINGS entry before anyone trusts the conductor side of this mechanism. Co-Authored-By: Claude Sonnet 5 --- sources/diagram.cpp | 36 +- sources/diagram.h | 4 +- .../qttest/fixtures/folio_counters_multi.qet | 401 ++++++++++++++++++ 3 files changed, 433 insertions(+), 8 deletions(-) create mode 100644 tests/qttest/fixtures/folio_counters_multi.qet diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 81ce1e21a..42ce8d22f 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -2154,34 +2154,46 @@ bool Diagram::fromXml(QDomElement &document, QStringLiteral("elementunitfolioseq"), QStringLiteral("sequf_"), QStringLiteral("unitfolioseq"), - QStringLiteral("elementautonumfoliosequentials")); + QStringLiteral("elementautonumfoliosequentials"), + QStringLiteral("element"), + QStringLiteral("unitfolio")); folioSequentialsFromXml(root, &m_elmt_tenfolio_max, QStringLiteral("elementtenfolioseq"), QStringLiteral("seqtf_"), QStringLiteral("tenfolioseq"), - QStringLiteral("elementautonumfoliosequentials")); + QStringLiteral("elementautonumfoliosequentials"), + QStringLiteral("element"), + QStringLiteral("tenfolio")); folioSequentialsFromXml(root, &m_elmt_hundredfolio_max, QStringLiteral("elementhundredfolioseq"), QStringLiteral("seqhf_"), QStringLiteral("hundredfolioseq"), - QStringLiteral("elementautonumfoliosequentials")); + QStringLiteral("elementautonumfoliosequentials"), + QStringLiteral("element"), + QStringLiteral("hundredfolio")); //Load Conductor Folio Sequential folioSequentialsFromXml(root, &m_cnd_unitfolio_max, QStringLiteral("conductorunitfolioseq"), QStringLiteral("sequf_"), QStringLiteral("unitfolioseq"), - QStringLiteral("conductorautonumfoliosequentials")); + QStringLiteral("conductorautonumfoliosequentials"), + QStringLiteral("conductor"), + QStringLiteral("unitfolio")); folioSequentialsFromXml(root, &m_cnd_tenfolio_max, QStringLiteral("conductortenfolioseq"), QStringLiteral("seqtf_"), QStringLiteral("tenfolioseq"), - QStringLiteral("conductorautonumfoliosequentials")); + QStringLiteral("conductorautonumfoliosequentials"), + QStringLiteral("conductor"), + QStringLiteral("tenfolio")); folioSequentialsFromXml(root, &m_cnd_hundredfolio_max, QStringLiteral("conductorhundredfolioseq"), QStringLiteral("seqhf_"), QStringLiteral("hundredfolioseq"), - QStringLiteral("conductorautonumfoliosequentials")); + QStringLiteral("conductorautonumfoliosequentials"), + QStringLiteral("conductor"), + QStringLiteral("hundredfolio")); } // if child haven't got a child, loading is finish (diagram is empty) @@ -2587,7 +2599,9 @@ void Diagram::folioSequentialsFromXml(const QDomElement &root, const QString& folioSeq, const QString& seq, const QString& type, - const QString& autonumFolioSeqType) { + const QString& autonumFolioSeqType, + const QString& owner, + const QString& level) { foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) { for(QDomElement folioseq @@ -2604,6 +2618,14 @@ void Diagram::folioSequentialsFromXml(const QDomElement &root, i++; } hash->insert(title,list); + //2b-4, habit 4: populate the row from the + //document being parsed, not from a built + //scene -- this runs whether or not the + //folio ever becomes one. + if (!owner.isEmpty() && project()) { + project()->dataBase()->setFolioCounterValues( + uuid(), owner, level, title, list); + } } } } diff --git a/sources/diagram.h b/sources/diagram.h index fde76b109..509edfcea 100644 --- a/sources/diagram.h +++ b/sources/diagram.h @@ -297,7 +297,9 @@ class Diagram : public QGraphicsScene const QString&, const QString&, const QString&, - const QString&); + const QString&, + const QString &owner = QString(), + const QString &level = QString()); void refreshContents(); diff --git a/tests/qttest/fixtures/folio_counters_multi.qet b/tests/qttest/fixtures/folio_counters_multi.qet new file mode 100644 index 000000000..0e01e9fe1 --- /dev/null +++ b/tests/qttest/fixtures/folio_counters_multi.qet @@ -0,0 +1,401 @@ + + + 10/20/26 + 20-10-2026 + 2026-10-20 + skeleton + /tmp/qet-mcp-new-tulbg10x/skeleton.qet + 17:13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 01 + + + + + + + R%seqtf_1 + R01 + + + + + + + 02 + + + + + + + R%seqtf_1 + R02 + + + + + + + + + 01 + + + + + + + + + + + + + + + + 03 + + + + + + + R%seqtf_1 + R03 + + + + + + + 04 + + + + + + + R%seqtf_1 + R04 + + + + + + + + + 02 + + + + + + + + + + + + + + + + 05 + + + + + + + R%seqtf_1 + R05 + + + + + + + 06 + + + + + + + R%seqtf_1 + R06 + + + + + + + + + 03 + + + + + + + + Elements importats + Zavedené prvky + Importerede elementer + Importierte Elemente + Εισηγμένα στοιχεία + Imported elements + Elementos importados + Éléments importés + Uvezeni elementi + Elementi importati + インバートされた要素 + 전기 심볼 요소 + 전기 심볼 요소 + Elementen geïmporteerd + Elementen geïmporteerd + Elementy importowane + Elementos importados + Elementos importados + Elemente importate + Импортированные элементы + Uvoženi elementi + Importerade element + İthal öğeler + Імпортовані елементи + 导入元件 + + + + كهربائي + Elèctric + Elektrotechnika + Elektrisk + Elektrik + Ηλεκτρικά + Electric + Eléctrica + Sähkö + Electrique + Električno + Elektromos + Elettrica + 電気 + 전기 + Цахилгаан + Elektrisk + Elektrotechniek + Elektrisch + Elektrotechnika + Elétrico + Elétrica + Electric + Электротехника + Elektrické + Elektrika + Електрика + El + Elektrik + Електрика + 10_电气 + 电气工程 + + + + أحادي القطب + Unifilar + Jednopólové + Enkel leder + Einpolig + Μονογραμμικό + Single pole + Polo simple + Yksinapa + Unifilaire + Jednopolni + Egyvonalas + Unifilare + 単線 + 단-극 + Нэг туйл + Enpolt + Enkel pool + Enkelpolig + Schematy jednoliniowe + Unipolar + Unifilar + Unipolar + Однополюсные + Jednopólové + Enopolno + Једнополни + Enpolig + Tek kutuplu + Однополюсні + 11_单极 + + + + إلكترونيات وأشباه موصلات + Electrònica i semiconductors + Elektronika a polovodiče + Elektronik og halvledere + Elektronik und Halbleiter + Ηλεκτρονικά και ημιαγωγοί + Electronics and semiconductors + Electrónica y semiconductores + Elektroniikka ja puolijohteet + Electronique et semi-conducteurs + Elektronika i poluvodiči + Elektronika és félvezetők + Elettronica e semiconduttori + 電子と半導体 + 전자 및 반도체 + Электроник ба хагас дамжуулагч + Elektronikk og halvledere + Electronica en halfgeleiders + Elektronica en halfgeleiders + Elektronika i półprzewodniki + Eletrónica e semicondutores + Eletronica e semicondutoues + Electronică și semiconductoare + Электроника и полупроводники + Elektronika a polovodiče + Elektronika in polprevodniki + Електроника и полупроводници + Elektronik och halvledare + Elektronik ve yarı iletkenler + Електроніка та напівпровідники + 电子半导体 + + + + مُقاومة + Resistències + Rezistory + Modstande + Widerstände + Αντιστάσεις + Resistors + Resistencia + Vastukset + Résistances + Otpornici + Ellenállások + Resistori + 抵抗器 + 저항 + Эсэргүүцэл + Motstander + Weerstand + Weerstanden + Rezystory + Resistência + Resistores + Rezistoare + Резисторы + Rezistory + Upori + Отпорници + Motstånd + Dirençler + Резистори + 10_电阻器 + + + + + + مُقاومة + Resistència + Rezistor + Modstand + Widerstand + Αντίσταση + Resistor + Resistencia + Vastus + Résistance + Otpornik + Ellenállás + Resistore + 抵抗器 + 저항 + Резистор + Motstand + Weerstand + Weerstand + Rezystor + Resistência + Resistor + Rezistor + Резистор + Rezistor + Upor + Отпорник + Resistor + Direnç + Резистор + 电阻 + + Author: The QElectroTech team +License: see http://qelectrotech.org/wiki/doc/elements_license + + + + + + + + + + + + + + + + +