Move a symbol's kind information through the project database

QETZ-DB-FIRST 2d-2a: the first half of 2d-2 (QETZ-DB-FIRST-2D-SCOPE.md).
A symbol's kind information (NO/NC/SW/power and the like, baked into its
own definition and never edited after it is built -- the data
CrossRefItem::NOElements()/NCElements() read, through the already
@deprecated Element::kindInformations(), to classify a linked contact)
had no database-backed form at all: nothing could query it without
walking a live Element*.

Add an element_kind_information table, written through from
projectDataBase::placeElement()/unplaceElement() (the same hooks that
already write element_information), with Element::kindInformations() now
reading the store first -- same shape as elementInformations()/
ownInformations(). Added Element::ownKindInformations() as the raw
member accessor, mirroring ownInformations(), so storeElementKindInformation()
is called with the member value rather than the store-reading getter
(the same stale-echo trap storeBorder()/storeFolioNumber() avoid).

No automated test existed for cross-reference text or kind information
at all; added tst_elementkindinformation (a hand-written embedded-symbol
project, checked through the database via qet.query()) before touching
anything cross-reference-shaped, per the re-scoping in
QETZ-DB-FIRST-2D-SCOPE.md.

crossrefitem.cpp itself is untouched here: switching
NOElements()/NCElements() to read through this store is 2d-2b, once this
lands.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-23 13:29:07 +13:00
parent 2ae9196a09
commit 5c2726d34b
6 changed files with 267 additions and 2 deletions
+10
View File
@@ -136,6 +136,15 @@ class projectDataBase : public QObject
//each as "uuid: why"; empty when they all agree
QStringList elementInformationMismatches() const;
//The kind information of every symbol placed in the project, by
//symbol uuid (NO/NC/SW/power and the like, baked into the
//symbol's own definition, never edited after it is built): the
//store each symbol's kind information is written through. A
//symbol not placed keeps its own.
DiagramContext elementKindInformation(const QUuid &element) const;
bool storeElementKindInformation(const QUuid &element, const DiagramContext &information);
void forgetElementKindInformation(const QUuid &element);
//The title block properties of every folio of the project, by
//folio uuid: the store each folio's title block is written
//through. A folio not in a
@@ -423,6 +432,7 @@ class projectDataBase : public QObject
//cell is written when next read, as drawing items are.
QList<QPointer<Element>> m_moved_elements;
QHash<QUuid, DiagramContext> m_element_information;
QHash<QUuid, DiagramContext> m_element_kind_information;
//The placed symbols holding each uuid: a paste or a folio copy
//briefly gives a copy its original's uuid, so one uuid can have
//two symbols until the copy's is renewed.