mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-24 07:54:13 +02:00
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:
@@ -2297,6 +2297,20 @@ DiagramContext Element::elementInformations() const
|
||||
return m_data.m_informations;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Element::kindInformations
|
||||
@return this symbol's kind information (NO/NC/SW/power and the like,
|
||||
baked into its own definition, never edited after it is built): the
|
||||
project's store holds it once this symbol is placed, for one not
|
||||
placed (a preview, the symbol editor) its own copy.
|
||||
*/
|
||||
DiagramContext Element::kindInformations() const
|
||||
{
|
||||
if (projectDataBase *store = placedStore())
|
||||
return store->elementKindInformation(m_uuid);
|
||||
return m_kind_informations;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Element::placedStore
|
||||
@return the project database holding this symbol's information, or
|
||||
|
||||
Reference in New Issue
Block a user