|
wiRedPanda
Logic Circuit Simulator
|
Main circuit editing scene. More...
#include <Scene.h>
Public Member Functions | |
| void | addItem (QGraphicsItem *item) |
| Adds item to the scene and registers it in the per-scene ID registry. | |
| void | addItem (QMimeData *mimeData, std::optional< QPointF > scenePos=std::nullopt) |
| void | alignBottom () |
| Aligns selected elements' bottom edges to the bottommost selected edge. No-op below 2 elements. | |
| void | alignHorizontalCenter () |
| void | alignLeft () |
| Aligns selected elements' left edges to the leftmost selected edge. No-op below 2 elements. | |
| void | alignRight () |
| Aligns selected elements' right edges to the rightmost selected edge. No-op below 2 elements. | |
| void | alignTop () |
| Aligns selected elements' top edges to the topmost selected edge. No-op below 2 elements. | |
| void | alignVerticalCenter () |
| QRectF | cachedItemsBoundingRect () const |
| void | circuitHasChanged () |
| Emitted whenever the circuit changes (element added/removed/moved). | |
| ClipboardManager * | clipboardManager () |
| Returns the clipboard manager that handles copy, cut, paste and clone-drag. | |
| ConnectionManager * | connectionManager () |
| Returns the connection manager that handles wire creation, deletion, and hover feedback. | |
| bool | contains (int id) const |
| Returns true if an item with id is registered in this scene. | |
| QString | contextDir () const override |
| Returns the directory of the .panda file associated with this scene. | |
| void | contextMenu (const QPoint screenPos) |
| Opens the element/selection context menu at screenPos (driven by SceneInteraction on right-click). | |
| void | contextMenuPos (QPoint screenPos, QGraphicsItem *itemAtMouse) |
| Emitted when a context menu should appear. | |
| void | copyAction () |
| Copies the selected items to the internal clipboard. | |
| void | cutAction () |
| Cuts the selected items to the internal clipboard. | |
| void | deleteAction () |
| Deletes the currently selected items. | |
| SerializationContext | deserializationContext (QHash< quint64, Port * > &portMap, const QVersionNumber &version, SerializationPurpose purpose) |
| void | distributeHorizontally () |
| void | distributeVertically () |
| void | duplicateAction () |
| Duplicates the selection in place (leaves the system clipboard untouched). | |
| const QVector< GraphicElement * > | elements () const |
| Returns all graphic elements in the scene. | |
| const QVector< GraphicElement * > | elements (const QRectF &rect) const |
| Returns all graphic elements within rect. | |
| bool | eventFilter (QObject *watched, QEvent *event) override |
| void | fileDropRequested (const QString &filePath) |
| Emitted when a .panda file is dropped onto the canvas from the file manager. | |
| void | flipHorizontally () |
| Flips selected elements horizontally. | |
| void | flipVertically () |
| Flips selected elements vertically. | |
| void | forgetItemId (int id) |
| void | icOpenRequested (int elementId, const QString &blobName, const QString &filePath) |
| Emitted when an IC element is double-clicked to request opening its sub-circuit. | |
| void | icPreviewCancelRequested (IC *ic) |
| void | icPreviewHideRequested () |
| void | icPreviewMoved (IC *ic, const QPoint &screenPos) |
| void | icPreviewRequested (IC *ic, const QPoint &screenPos) |
| ICRegistry * | icRegistry () |
| Returns the IC definition registry for this scene. | |
| QGraphicsItem * | itemAt (QPointF pos) const |
| Returns the topmost item at pos, prioritising ports over elements. | |
| ItemWithId * | itemById (int id) const |
| Returns the item registered under id, or nullptr if not found. | |
| QList< QGraphicsItem * > | items (const QRectF &rect, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape, Qt::SortOrder order=Qt::AscendingOrder, const QTransform &deviceTransform=QTransform()) const |
| QList< QGraphicsItem * > | items (QPointF pos, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape, Qt::SortOrder order=Qt::AscendingOrder, const QTransform &deviceTransform=QTransform()) const |
| QList< QGraphicsItem * > | items (Qt::SortOrder order=Qt::AscendingOrder) const |
| int | lastId () const |
| Returns the current highest ID in use by this scene. | |
| QPointF | mousePos () const |
| Returns the last known mouse position in scene coordinates. | |
| void | mute (const bool mute=true) |
| Mutes or unmutes selected elements according to mute. | |
| void | nextElm () |
| Cycles selection forward to the next element. | |
| int | nextId () |
| Returns the next available scene-local ID (does not assign it). | |
| void | nextMainPropShortcut () |
| Advances the main property of selected elements to the next value. | |
| void | nextSecndPropShortcut () |
| Advances the secondary property of selected elements to the next value. | |
| void | noteWireActivity () |
| void | openTruthTableRequested () |
| Emitted when a TruthTable element is double-clicked to request opening its editor. | |
| void | pasteAction () |
| Pastes items from the internal clipboard into the scene. | |
| Port * | portAt (QPointF pos) const |
| void | prevElm () |
| Cycles selection backward to the previous element. | |
| void | prevMainPropShortcut () |
| Retreats the main property of selected elements to the previous value. | |
| void | prevSecndPropShortcut () |
| Retreats the secondary property of selected elements to the previous value. | |
| PropertyShortcutHandler * | propertyShortcutHandler () |
| Returns the handler for keyboard shortcuts that cycle element properties. | |
| void | receiveCommand (QUndoCommand *cmd) |
| Pushes cmd onto the undo stack (immediately executes its redo()). | |
| void | recordWirePaintPass (qint64 elapsedNs) |
| QAction * | redoAction () const |
| Returns the redo QAction bound to the undo stack. | |
| void | removeItem (QGraphicsItem *item) |
| Removes item from the scene and unregisters it from the per-scene ID registry. | |
| void | resizeScene () |
| Tightens the scene rect to item bounds while preserving the viewport position. | |
| void | restoreWireAntialiasing () |
| void | retranslateUi () |
| Updates undo/redo action text to reflect the current UI language. | |
| void | rotateLeft () |
| Rotates selected elements 90 degrees counter-clockwise. | |
| void | rotateRight () |
| Rotates selected elements 90 degrees clockwise. | |
| Scene (QObject *parent=nullptr) | |
| Constructs a Scene and initialises the undo stack and simulation. | |
| void | selectAll () |
| Selects all items in the scene. | |
| const QList< GraphicElement * > | selectedElements () const |
| Returns the list of currently selected graphic elements. | |
| void | setAutosaveRequired () |
| Schedules an autosave of the current circuit state. | |
| void | setCircuitUpdateRequired () |
| Marks the simulation mapping as stale so it is rebuilt on the next tick. | |
| void | setContextDir (const QString &dir) |
| Sets the directory of the .panda file associated with this scene. | |
| void | setLastId (int newLastId) |
| Advances the scene's ID counter to at least newLastId. | |
| void | setMuted (const bool muted) override |
| void | setPropertyUpdateRequired () |
| void | setView (GraphicsView *view) |
| Sets the GraphicsView that displays this scene to view. | |
| void | showGates (bool checked) |
| Shows or hides gate elements. Delegates to VisibilityManager. | |
| void | showStatusMessage (const QString &message) |
| void | showStatusMessageRequested (const QString &message) |
| void | showWires (bool checked) |
| Shows or hides connection wires. Delegates to VisibilityManager. | |
| Simulation * | simulation () |
| Returns the simulation engine associated with this scene. | |
| QList< QGraphicsItem * > | simulationItems () const override |
| void | truthTableElementChanged (GraphicElement *element) |
| Emitted after a TruthTable element's output bit is toggled (redo or undo). | |
| QAction * | undoAction () const |
| Returns the undo QAction bound to the undo stack. | |
| QUndoStack * | undoStack () |
| Returns the scene's undo stack. | |
| const QVector< GraphicElement * > | unsortedElements () const |
| void | updateItemId (ItemWithId *item, int newId) |
| Reassigns the ID of item to newId without adding it to the scene. | |
| void | updateTheme () |
| Propagates the current theme to all elements and connections. | |
| GraphicsView * | view () const |
| Returns the GraphicsView currently displaying this scene. | |
| VisibilityManager * | visibilityManager () |
| Returns the visibility manager for this scene. | |
| const QVector< GraphicElement * > | visibleElements () const |
| Returns all visible (non-hidden) graphic elements in the scene. | |
| bool | wireAntialiasingEnabled () const |
true while wires should stroke with antialiasing; Connection::paint() consults this. | |
| Public Member Functions inherited from ContextDirProvider | |
| virtual | ~ContextDirProvider ()=default |
| Public Member Functions inherited from SimulationHost | |
| virtual | ~SimulationHost ()=default |
Static Public Member Functions | |
| static QString | droppedPandaFile (const QMimeData *mimeData) |
| static bool | isConnectionAllowed (OutputPort *startPort, InputPort *endPort) |
Returns true if a wire from startPort to endPort is permitted. | |
| static QVector< GraphicElement * > | sortByTopology (QVector< GraphicElement * > elements) |
| Returns elements sorted in topological dependency order (inputs first). | |
| static QHash< QString, InputPort * > | wirelessTxInputPorts (const QVector< GraphicElement * > &elements) |
| Returns a map from wireless channel label to the Tx node's input port. | |
Protected Member Functions | |
| void | dragEnterEvent (QGraphicsSceneDragDropEvent *event) override |
| void | dragMoveEvent (QGraphicsSceneDragDropEvent *event) override |
| void | dropEvent (QGraphicsSceneDragDropEvent *event) override |
| void | helpEvent (QGraphicsSceneHelpEvent *event) override |
| void | keyPressEvent (QKeyEvent *event) override |
| void | keyReleaseEvent (QKeyEvent *event) override |
| void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
| void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
| void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
| void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
Main circuit editing scene.
The Scene class extends QGraphicsScene to provide the main circuit editing environment. It manages circuit elements and their connections, handles user interactions like selection, copying, pasting and rotation. Scene also implements undo/redo functionality and handles various user interface events like drag-and-drop, keyboard shortcuts, and mouse operations.
|
explicit |
Constructs a Scene and initialises the undo stack and simulation.
Definition at line 69 of file Scene.cpp.
References ThemeManager::instance(), ThemeManager::themeChanged(), and updateTheme().
| void Scene::addItem | ( | QGraphicsItem * | item | ) |
Adds item to the scene and registers it in the per-scene ID registry.
Definition at line 119 of file Scene.cpp.
References icOpenRequested(), icPreviewCancelRequested(), icPreviewHideRequested(), icPreviewMoved(), icPreviewRequested(), GraphicElement::inlineEditRequested(), nextId(), openTruthTableRequested(), IC::previewCancelRequested(), IC::previewHideRequested(), IC::previewMoved(), IC::previewRequested(), IC::requestOpenSubCircuit(), TruthTable::requestOpenTruthTableEditor(), setLastId(), and GraphicElement::Type.
Referenced by CommandUtils::addItems().
| void Scene::addItem | ( | QMimeData * | mimeData, |
| std::optional< QPointF > | scenePos = std::nullopt ) |
| void Scene::alignBottom | ( | ) |
Aligns selected elements' bottom edges to the bottommost selected edge. No-op below 2 elements.
Definition at line 1001 of file Scene.cpp.
References selectedElements().
| void Scene::alignHorizontalCenter | ( | ) |
Aligns selected elements' horizontal (X) centers so they share one vertical line. No-op below 2 elements.
Definition at line 1023 of file Scene.cpp.
References selectedElements().
| void Scene::alignLeft | ( | ) |
Aligns selected elements' left edges to the leftmost selected edge. No-op below 2 elements.
Definition at line 935 of file Scene.cpp.
References selectedElements().
| void Scene::alignRight | ( | ) |
Aligns selected elements' right edges to the rightmost selected edge. No-op below 2 elements.
Definition at line 957 of file Scene.cpp.
References selectedElements().
| void Scene::alignTop | ( | ) |
Aligns selected elements' top edges to the topmost selected edge. No-op below 2 elements.
Definition at line 979 of file Scene.cpp.
References selectedElements().
| void Scene::alignVerticalCenter | ( | ) |
Aligns selected elements' vertical (Y) centers so they share one horizontal line. No-op below 2 elements.
Definition at line 1046 of file Scene.cpp.
References selectedElements().
|
nodiscard |
Returns itemsBoundingRect(), cached and invalidated on structural/positional edits (see setPropertyUpdateRequired()) — an O(total items) call this project's zoom/pan/ scroll paths (resizeScene(), MinimapWidget) would otherwise redo on every step even though panning/zooming never changes which items exist or where they are. Bypasses the cache during an active element drag, where the live (uncached) value is required: see resizeScene()'s isDraggingElement() branch.
Definition at line 527 of file Scene.cpp.
Referenced by resizeScene().
| void Scene::circuitHasChanged | ( | ) |
Emitted whenever the circuit changes (element added/removed/moved).
Referenced by SceneUiBinder::bind(), MinimapWidget::MinimapWidget(), ExerciseEngine::setScene(), ExerciseEngine::start(), ExerciseEngine::stop(), SceneUiBinder::unbind(), and WorkSpace::WorkSpace().
|
inline |
|
inline |
|
nodiscard |
Returns true if an item with id is registered in this scene.
Definition at line 176 of file Scene.cpp.
Referenced by contextMenu().
|
inlineoverridevirtual |
Returns the directory of the .panda file associated with this scene.
Implements ContextDirProvider.
Definition at line 352 of file Scene.h.
Referenced by deserializationContext(), ICController::embedICByFile(), ICController::embedSelectedIC(), ICController::extractICByBlobName(), ICController::extractSelectedIC(), and ICController::makeSelfContained().
| void Scene::contextMenu | ( | const QPoint | screenPos | ) |
Opens the element/selection context menu at screenPos (driven by SceneInteraction on right-click).
Definition at line 781 of file Scene.cpp.
References ClipboardManager::canPaste(), contains(), contextMenuPos(), elements(), itemAt(), pasteAction(), selectAll(), and GraphicElement::Type.
| void Scene::contextMenuPos | ( | QPoint | screenPos, |
| QGraphicsItem * | itemAtMouse ) |
Emitted when a context menu should appear.
| screenPos | Screen coordinates of the right-click. |
| itemAtMouse | Item under the mouse pointer (may be nullptr). |
Referenced by contextMenu(), and ElementEditor::setScene().
| void Scene::copyAction | ( | ) |
Copies the selected items to the internal clipboard.
Definition at line 814 of file Scene.cpp.
References sentryBreadcrumb().
Referenced by ElementContextMenu::exec().
| void Scene::cutAction | ( | ) |
Cuts the selected items to the internal clipboard.
Definition at line 820 of file Scene.cpp.
References sentryBreadcrumb().
Referenced by ElementContextMenu::exec().
| void Scene::deleteAction | ( | ) |
Deletes the currently selected items.
Definition at line 838 of file Scene.cpp.
References receiveCommand(), and sentryBreadcrumb().
Referenced by ElementContextMenu::exec().
| SerializationContext Scene::deserializationContext | ( | QHash< quint64, Port * > & | portMap, |
| const QVersionNumber & | version, | ||
| SerializationPurpose | purpose ) |
Creates a deserialization context with the scene's contextDir and blob registry. purpose has no default – every caller must state whether this deserializes a genuine .panda file or an in-session snapshot; see SerializationPurpose.
Definition at line 216 of file Scene.cpp.
References SerializationContext::blobRegistry, and contextDir().
Referenced by CommandUtils::loadItems(), and ICRegistry::rollbackElements().
| void Scene::distributeHorizontally | ( | ) |
Redistributes selected elements with equal horizontal gaps between edges, keeping the leftmost and rightmost elements fixed as anchors. No-op below 3 elements.
Definition at line 1069 of file Scene.cpp.
References selectedElements().
| void Scene::distributeVertically | ( | ) |
Redistributes selected elements with equal vertical gaps between edges, keeping the topmost and bottommost elements fixed as anchors. No-op below 3 elements.
Definition at line 1106 of file Scene.cpp.
References selectedElements().
|
overrideprotected |
Definition at line 1160 of file Scene.cpp.
References droppedPandaFile(), and SceneDropHandler::isSupportedDropFormat().
|
overrideprotected |
Definition at line 1171 of file Scene.cpp.
References droppedPandaFile(), and SceneDropHandler::isSupportedDropFormat().
|
overrideprotected |
Definition at line 1182 of file Scene.cpp.
References MimeType::CloneDrag, MimeType::CloneDragLegacy, MimeType::DragDrop, MimeType::DragDropLegacy, droppedPandaFile(), fileDropRequested(), and sentryBreadcrumb().
|
static |
Returns the path of the first local .panda file in mimeData's URL list (the file a file-manager drop would open), or an empty string if there is none.
Definition at line 1143 of file Scene.cpp.
Referenced by dragEnterEvent(), dragMoveEvent(), and dropEvent().
| void Scene::duplicateAction | ( | ) |
Duplicates the selection in place (leaves the system clipboard untouched).
Definition at line 832 of file Scene.cpp.
References sentryBreadcrumb().
| const QVector< GraphicElement * > Scene::elements | ( | ) | const |
Returns all graphic elements in the scene.
Definition at line 336 of file Scene.cpp.
References sortByTopology(), and unsortedElements().
Referenced by DolphinModelBuilder::collect(), contextMenu(), main(), ICController::makeSelfContained(), sortByTopology(), updateTheme(), visibleElements(), and wirelessTxInputPorts().
| const QVector< GraphicElement * > Scene::elements | ( | const QRectF & | rect | ) | const |
Returns all graphic elements within rect.
Definition at line 356 of file Scene.cpp.
References items(), sortByTopology(), and GraphicElement::Type.
|
override |
Definition at line 1301 of file Scene.cpp.
References itemAt(), Connection::Type, and GraphicElement::Type.
| void Scene::fileDropRequested | ( | const QString & | filePath | ) |
Emitted when a .panda file is dropped onto the canvas from the file manager.
Referenced by dropEvent().
| void Scene::flipHorizontally | ( | ) |
Flips selected elements horizontally.
Definition at line 893 of file Scene.cpp.
References receiveCommand(), selectedElements(), and sentryBreadcrumb().
| void Scene::flipVertically | ( | ) |
Flips selected elements vertically.
Definition at line 903 of file Scene.cpp.
References receiveCommand(), selectedElements(), and sentryBreadcrumb().
| void Scene::forgetItemId | ( | int | id | ) |
Drops a stale registry entry by ID without dereferencing the item. Needed when Qt's parent-child cascade destroys an item: it removes the item from QGraphicsScene via the non-virtual base removeItem, bypassing our override and leaving the m_elementRegistry entry pointing at freed memory.
|
overrideprotected |
| void Scene::icOpenRequested | ( | int | elementId, |
| const QString & | blobName, | ||
| const QString & | filePath ) |
Emitted when an IC element is double-clicked to request opening its sub-circuit.
Referenced by addItem(), and SceneUiBinder::unbind().
| void Scene::icPreviewCancelRequested | ( | IC * | ic | ) |
Referenced by addItem(), and SceneUiBinder::unbind().
| void Scene::icPreviewHideRequested | ( | ) |
Referenced by addItem(), and SceneUiBinder::unbind().
| void Scene::icPreviewMoved | ( | IC * | ic, |
| const QPoint & | screenPos ) |
Referenced by addItem(), and SceneUiBinder::unbind().
| void Scene::icPreviewRequested | ( | IC * | ic, |
| const QPoint & | screenPos ) |
Referenced by addItem(), and SceneUiBinder::unbind().
|
inline |
Returns the IC definition registry for this scene.
Definition at line 359 of file Scene.h.
Referenced by ICController::embedICByFile(), ICController::embedSelectedIC(), ICController::extractICByBlobName(), ICController::extractSelectedIC(), ICController::makeSelfContained(), and ElementPalette::updateEmbeddedICList().
|
static |
Returns true if a wire from startPort to endPort is permitted.
Delegates to ConnectionManager::isConnectionAllowed().
Definition at line 677 of file Scene.cpp.
References ConnectionManager::isConnectionAllowed().
| QGraphicsItem * Scene::itemAt | ( | QPointF | pos | ) | const |
Returns the topmost item at pos, prioritising ports over elements.
Definition at line 441 of file Scene.cpp.
References items(), GraphicElement::Type, and Port::Type.
Referenced by contextMenu(), and eventFilter().
|
nodiscard |
Returns the item registered under id, or nullptr if not found.
Definition at line 171 of file Scene.cpp.
Referenced by CommandUtils::findConn(), CommandUtils::findElements(), CommandUtils::findElm(), CommandUtils::findItems(), WorkSpace::loadFromBlob(), BaseHandler::validatedElement(), and BaseHandler::validateElementId().
| QList< QGraphicsItem * > Scene::items | ( | const QRectF & | rect, |
| Qt::ItemSelectionMode | mode = Qt::IntersectsItemShape, | ||
| Qt::SortOrder | order = Qt::AscendingOrder, | ||
| const QTransform & | deviceTransform = QTransform() ) const |
| QList< QGraphicsItem * > Scene::items | ( | QPointF | pos, |
| Qt::ItemSelectionMode | mode = Qt::IntersectsItemShape, | ||
| Qt::SortOrder | order = Qt::AscendingOrder, | ||
| const QTransform & | deviceTransform = QTransform() ) const |
| QList< QGraphicsItem * > Scene::items | ( | Qt::SortOrder | order = Qt::AscendingOrder | ) | const |
Definition at line 718 of file Scene.cpp.
Referenced by elements(), itemAt(), portAt(), selectAll(), simulationItems(), and unsortedElements().
|
overrideprotected |
Definition at line 1249 of file Scene.cpp.
References unsortedElements().
|
overrideprotected |
Definition at line 1278 of file Scene.cpp.
References unsortedElements().
| int Scene::lastId | ( | ) | const |
|
overrideprotected |
|
overrideprotected |
|
inlinenodiscard |
|
overrideprotected |
|
overrideprotected |
| void Scene::mute | ( | const bool | mute = true | ) |
Mutes or unmutes selected elements according to mute.
Definition at line 884 of file Scene.cpp.
References mute(), and unsortedElements().
Referenced by mute(), and setMuted().
| void Scene::nextElm | ( | ) |
| int Scene::nextId | ( | ) |
| void Scene::nextMainPropShortcut | ( | ) |
| void Scene::nextSecndPropShortcut | ( | ) |
| void Scene::noteWireActivity | ( | ) |
Marks wire activity for idle detection; Connection::setStatus() calls this on every real status change. Cheap (timestamp restart), safe at simulation flip rates.
| void Scene::openTruthTableRequested | ( | ) |
Emitted when a TruthTable element is double-clicked to request opening its editor.
Referenced by addItem(), and SceneUiBinder::unbind().
| void Scene::pasteAction | ( | ) |
Pastes items from the internal clipboard into the scene.
Definition at line 826 of file Scene.cpp.
References sentryBreadcrumb().
Referenced by contextMenu().
|
nodiscard |
Returns the topmost port within itemsAt()'s hit area of pos, or nullptr. Bounding-box-based fast path for per-mouse-move consumers – unlike itemAt(), never exact-shape-tests wires or elements (see the implementation comment).
Definition at line 480 of file Scene.cpp.
References items(), and Port::Type.
Referenced by helpEvent().
| void Scene::prevElm | ( | ) |
| void Scene::prevMainPropShortcut | ( | ) |
| void Scene::prevSecndPropShortcut | ( | ) |
|
inline |
| void Scene::receiveCommand | ( | QUndoCommand * | cmd | ) |
Pushes cmd onto the undo stack (immediately executes its redo()).
Definition at line 520 of file Scene.cpp.
References sentryBreadcrumb().
Referenced by ICController::addEmbeddedICFromFile(), deleteAction(), ICController::embedICByFile(), flipHorizontally(), flipVertically(), and ElementEditor::setScene().
| void Scene::recordWirePaintPass | ( | qint64 | elapsedNs | ) |
Feeds one measured view paint pass (GraphicsView::paintEvent times its base call). MinimapWidget's off-view scene renders never reach this, so they can't skew decisions.
Definition at line 549 of file Scene.cpp.
References restoreWireAntialiasing().
| QAction * Scene::redoAction | ( | ) | const |
| void Scene::removeItem | ( | QGraphicsItem * | item | ) |
Removes item from the scene and unregisters it from the per-scene ID registry.
Definition at line 160 of file Scene.cpp.
Referenced by CommandUtils::deleteItems(), and CommandUtils::drainPortConnections().
| void Scene::resizeScene | ( | ) |
Tightens the scene rect to item bounds while preserving the viewport position.
Definition at line 635 of file Scene.cpp.
References cachedItemsBoundingRect(), and view().
Referenced by WorkSpace::WorkSpace().
| void Scene::restoreWireAntialiasing | ( | ) |
Restores wire antialiasing and schedules the refinement repaint. Invoked by the idle timer and the sustained-headroom path; public so a pass-free quality reset is possible (and directly drivable from tests).
Definition at line 599 of file Scene.cpp.
Referenced by recordWirePaintPass().
| void Scene::retranslateUi | ( | ) |
| void Scene::rotateLeft | ( | ) |
Rotates selected elements 90 degrees counter-clockwise.
Definition at line 869 of file Scene.cpp.
References sentryBreadcrumb().
| void Scene::rotateRight | ( | ) |
Rotates selected elements 90 degrees clockwise.
Definition at line 863 of file Scene.cpp.
References sentryBreadcrumb().
| void Scene::selectAll | ( | ) |
Selects all items in the scene.
Definition at line 854 of file Scene.cpp.
References items().
Referenced by contextMenu().
| const QList< GraphicElement * > Scene::selectedElements | ( | ) | const |
Returns the list of currently selected graphic elements.
Definition at line 427 of file Scene.cpp.
References GraphicElement::Type.
Referenced by alignBottom(), alignHorizontalCenter(), alignLeft(), alignRight(), alignTop(), alignVerticalCenter(), distributeHorizontally(), distributeVertically(), flipHorizontally(), and flipVertically().
| void Scene::setAutosaveRequired | ( | ) |
| void Scene::setCircuitUpdateRequired | ( | ) |
Marks the simulation mapping as stale so it is rebuilt on the next tick.
Definition at line 298 of file Scene.cpp.
References setPropertyUpdateRequired().
|
inline |
| void Scene::setLastId | ( | int | newLastId | ) |
|
inlineoverridevirtual |
Implements SimulationHost.
Definition at line 347 of file Scene.h.
References mute().
| void Scene::setPropertyUpdateRequired | ( | ) |
Refreshes visuals and marks the scene dirty without rebuilding the simulation graph, for property-only edits (label, color, delay, ...) that don't add, remove, or reconnect elements.
Definition at line 313 of file Scene.cpp.
Referenced by setCircuitUpdateRequired().
| void Scene::setView | ( | GraphicsView * | view | ) |
Sets the GraphicsView that displays this scene to view.
Definition at line 748 of file Scene.cpp.
References view().
| void Scene::showGates | ( | bool | checked | ) |
Shows or hides gate elements. Delegates to VisibilityManager.
| void Scene::showStatusMessage | ( | const QString & | message | ) |
Emits showStatusMessageRequested() so the bound chrome can surface message in the status bar (used to explain a rejected wire instead of dropping it silently).
Definition at line 682 of file Scene.cpp.
References showStatusMessageRequested().
| void Scene::showStatusMessageRequested | ( | const QString & | message | ) |
Requests that message be shown transiently in the status bar (e.g. why a wire was rejected). Routed to the status bar by SceneUiBinder.
Referenced by SceneUiBinder::bind(), showStatusMessage(), and SceneUiBinder::unbind().
| void Scene::showWires | ( | bool | checked | ) |
Shows or hides connection wires. Delegates to VisibilityManager.
| Simulation * Scene::simulation | ( | ) |
|
inlineoverridevirtual |
Implements SimulationHost.
Definition at line 345 of file Scene.h.
References items().
|
static |
Returns elements sorted in topological dependency order (inputs first).
Definition at line 371 of file Scene.cpp.
References calculatePriorities(), and elements().
Referenced by elements(), and elements().
| void Scene::truthTableElementChanged | ( | GraphicElement * | element | ) |
Emitted after a TruthTable element's output bit is toggled (redo or undo).
| element | The TruthTable element that changed. |
Referenced by ElementEditor::setScene().
| QAction * Scene::undoAction | ( | ) | const |
| QUndoStack * Scene::undoStack | ( | ) |
| const QVector< GraphicElement * > Scene::unsortedElements | ( | ) | const |
Returns all graphic elements without the topological sort — for hot paths (key triggers, mute) that don't care about evaluation order.
Definition at line 341 of file Scene.cpp.
References items(), and GraphicElement::Type.
Referenced by elements(), keyPressEvent(), keyReleaseEvent(), and mute().
| void Scene::updateItemId | ( | ItemWithId * | item, |
| int | newId ) |
Reassigns the ID of item to newId without adding it to the scene.
Used by undo/redo commands (loadItems, SplitCommand, MorphCommand) to restore an element's original ID before calling addItem(). The item must NOT be in the scene registry yet when this is called.
Definition at line 196 of file Scene.cpp.
Referenced by CommandUtils::loadItems().
| void Scene::updateTheme | ( | ) |
Propagates the current theme to all elements and connections.
Definition at line 699 of file Scene.cpp.
References ThemeManager::attributes(), elements(), ThemeAttributes::m_sceneBgBrush, ThemeAttributes::m_sceneBgDots, and qCDebug.
Referenced by Scene().
| GraphicsView * Scene::view | ( | ) | const |
Returns the GraphicsView currently displaying this scene.
Definition at line 743 of file Scene.cpp.
Referenced by ClipboardManager::cloneDrag(), resizeScene(), and setView().
|
inline |
| const QVector< GraphicElement * > Scene::visibleElements | ( | ) | const |
Returns all visible (non-hidden) graphic elements in the scene.
Definition at line 329 of file Scene.cpp.
References elements().
Referenced by ElementTabNavigator::eventFilter().
|
nodiscard |
true while wires should stroke with antialiasing; Connection::paint() consults this.
|
static |
Returns a map from wireless channel label to the Tx node's input port.
Scans elements for nodes in WirelessMode::Tx, keyed by label. If two Tx nodes share the same label the first one wins. Used by codegens to resolve Rx node signals without duplicating the wireless scan.
Definition at line 399 of file Scene.cpp.
References elements().
Referenced by ArduinoCodeGen::generate(), and SystemVerilogCodeGen::generate().