Keep the project's numbering in the project database too

QETZ-DB-FIRST stage 2b-1. The numbering schemes of wires, symbols,
folios and cables, and the settings saved with them (the scheme in use
of each kind, freezing new labels, auto-break, the cable axis and
question), get three tables of the project database: numbering_scheme,
numbering_part (one row per part, in order) and numbering_setting.
QETProject writes them when it reads its file and after each change of
its numbering, from every setter; nothing reads them yet.

The save writes the numbering through writeNumberingXml(), the code it
had moved out of writeDefaultPropertiesXml(), so the same writer can
take the rows once the save moves to them (2b-2).
QET_CHECK_NUMBERING_ROWS=1 writes the numbering from the project and
from the rows at each save and says whether the two differ.
tst_elementautonumids::numberingRowsFollowEveryChange checks it after
each of 23 changes; with one setter not writing the rows, one save
differs and it fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-19 21:33:49 +13:00
parent 992058348b
commit d05cc654ad
5 changed files with 376 additions and 55 deletions
+23
View File
@@ -36,6 +36,7 @@
#include "../titleblockproperties.h"
#include "../conductorproperties.h"
#include "../autoNum/assignvariables.h"
#include "../autoNum/numerotationcontext.h"
class Element;
class QETProject;
@@ -156,6 +157,28 @@ class projectDataBase : public QObject
void conductorUuidChanged(Conductor *conductor, const QUuid &old_uuid);
QStringList conductorPropertiesMismatches() const;
QStringList linkRowMismatches();
/// A numbering scheme of the project (QETZ-DB-FIRST stage 2b)
struct NumberingScheme {
QString kind; ///< conductor, element, folio or cable
QString title;
QUuid uuid; ///< element schemes only
NumerotationContext context;
};
/// The project's numbering: its schemes of every kind and the
/// settings saved with them
struct Numbering {
QList<NumberingScheme> schemes;
QString current_conductor;
QString current_element;
QString current_cable;
bool freeze_new_conductors = false;
bool freeze_new_elements = false;
bool auto_break_conductors = false;
bool cable_x_axis_first = true;
bool cable_ask_numbering = true;
};
void setNumbering(const Numbering &numbering);
Numbering numbering() const;
bool savedLinks(const Element *element, QList<std::pair<QUuid, int>> *links);
//The link rows are written (opening filled them): a symbol
//built links from them (Element::initLink())