|
wiRedPanda
Logic Circuit Simulator
|
Base class providing a unique integer identifier for circuit items. More...
#include <ItemWithId.h>
Public Member Functions | |
| int | id () const |
| Returns the unique integer identifier of this item, or -1 if unassigned. | |
| ItemWithId ()=default | |
| Constructs a new ItemWithId with an unassigned ID of -1. | |
| void | setId (const int id) |
| Sets the identifier to id. | |
| virtual | ~ItemWithId () |
| Self-unregisters from the current SceneItemRegistry, if any. | |
Friends | |
| class | SceneItemRegistry |
Base class providing a unique integer identifier for circuit items.
Every graphic element and connection inherits from ItemWithId to obtain a stable numeric ID managed by the owning Scene. IDs start as -1 (unassigned) and are set to a positive value when the item is added to a Scene via Scene::addItem(). The ID is used for undo/redo serialization and cross-reference during load/save.
Also self-unregisters from whichever SceneItemRegistry it is currently registered with, on ANY destruction path — including Qt's own parent-child cascade-delete, which bypasses Scene::removeItem's override. This structurally prevents a stale id->item registry entry from ever outliving the item (the WIREDPANDA-HC bug family).
Definition at line 30 of file ItemWithId.h.
|
default |
Constructs a new ItemWithId with an unassigned ID of -1.
|
virtual |
Self-unregisters from the current SceneItemRegistry, if any.
Definition at line 8 of file ItemWithId.cpp.
|
inline |
Returns the unique integer identifier of this item, or -1 if unassigned.
Definition at line 40 of file ItemWithId.h.
Referenced by UpdateBlobCommand::captureConnections(), SceneItemRegistry::forget(), SceneItemRegistry::registerItem(), ConnectionSerializer::save(), GraphicElementSerializer::save(), setId(), SplitCommand::SplitCommand(), ToggleTruthTableOutputCommand::ToggleTruthTableOutputCommand(), and SceneItemRegistry::unregisterItem().
|
inline |
Sets the identifier to id.
| id | New identifier value. |
Definition at line 46 of file ItemWithId.h.
References id().
Referenced by SceneItemRegistry::updateItemId().
|
friend |
Definition at line 49 of file ItemWithId.h.
References SceneItemRegistry.
Referenced by SceneItemRegistry.