wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
Scene.h
Go to the documentation of this file.
1// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2// SPDX-License-Identifier: GPL-3.0-or-later
3
7
8#pragma once
9
10#include <optional>
11
12#include <QElapsedTimer>
13#include <QGraphicsScene>
14#include <QHash>
15#include <QMap>
16#include <QMimeData>
17#include <QPoint>
18#include <QTimer>
19#include <QUndoCommand>
20#include <QVersionNumber>
21
34#include "App/Wiring/Port.h"
35
36class GraphicElement;
37class GraphicsView;
38class IC;
39class ItemWithId;
40class Connection;
41class QPainter;
43enum class SerializationPurpose;
44
55class Scene : public QGraphicsScene, public ContextDirProvider, public SimulationHost
56{
57 Q_OBJECT
58
59public:
61 void addItem(QGraphicsItem *item);
62
64 void removeItem(QGraphicsItem *item);
65
67 void resizeScene();
68
75 [[nodiscard]] QRectF cachedItemsBoundingRect() const;
76
77 // --- Adaptive wire antialiasing ---
78 //
79 // Antialiased wire strokes cost ~5x the raster time of plain ones, and on a large clocked
80 // circuit the simulation recolours wires across the whole viewport continuously -- each
81 // repaint pass re-strokes every visible wire, pinning the GUI thread. Quality adapts with
82 // the standard split used for binary quality knobs elsewhere (game-engine dynamic
83 // resolution scaling degrades on the measured frame-time budget; browsers, GIS canvases
84 // and EDA tools restore full quality when the activity causing the load stops):
85 //
86 // 1. Degrade: wire antialiasing turns off when the measured pass time stays over budget
87 // (debounced, so a one-off compositor stall or load spike never triggers).
88 // 2. Restore on idle: antialiasing returns (plus one refinement repaint, free by
89 // definition on an idle view) once BOTH activity streams have gone quiet -- paint
90 // passes for a short window (an interaction gesture ended), and wire status flips
91 // for a longer window (clock-driven flips arrive in bursts at each clock edge, so
92 // the window must span inter-edge gaps -- seconds for slow educational clocks --
93 // or the restore fires inside a gap and quality oscillates with the clock).
94 // Neither stream alone suffices: pass cadence is bursty mid-storm, and flips stop
95 // entirely on combinational circuits whose simulation still runs.
96 // 3. Restore on sustained deep headroom: a light workload that never goes idle (small
97 // region in view while the simulation runs) restores once passes stay under
98 // budget / worst-case-AA-ratio, which bounds the restored antialiased pass to within
99 // budget by construction.
100 //
101 // Restoration deliberately never keys on the degraded renderer merely being "fast enough":
102 // with a binary knob that measured speed is a consequence of the decision itself and
103 // oscillates quality at the pass rate. Only wires change quality -- elements, ports and
104 // text keep the view's render hints.
105
107 [[nodiscard]] bool wireAntialiasingEnabled() const;
108
111 void recordWirePaintPass(qint64 elapsedNs);
112
115 void noteWireActivity();
116
121
122 // --- Per-Scene Element Registry ---
123
125 [[nodiscard]] ItemWithId *itemById(int id) const;
126
128 [[nodiscard]] bool contains(int id) const;
129
131 int lastId() const;
132
134 void setLastId(int newLastId);
135
137 int nextId();
138
145 void updateItemId(ItemWithId *item, int newId);
146
152 void forgetItemId(int id);
153
154 // --- Lifecycle ---
155
157 explicit Scene(QObject *parent = nullptr);
158
159 // --- View / Display Management ---
160
162 GraphicsView *view() const;
165
167 void showGates(bool checked);
168
170 void showWires(bool checked);
171
173 VisibilityManager *visibilityManager() { return &m_visibilityManager; }
174
175 // --- Element Access / Queries ---
176
178 QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const;
180 QList<QGraphicsItem *> items(QPointF pos, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::AscendingOrder, const QTransform &deviceTransform = QTransform()) const;
182 QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::AscendingOrder, const QTransform &deviceTransform = QTransform()) const;
184 const QList<GraphicElement *> selectedElements() const;
186 const QVector<GraphicElement *> elements() const;
188 const QVector<GraphicElement *> elements(const QRectF &rect) const;
191 static QString droppedPandaFile(const QMimeData *mimeData);
194 const QVector<GraphicElement *> unsortedElements() const;
196 static QVector<GraphicElement *> sortByTopology(QVector<GraphicElement *> elements);
203 static QHash<QString, InputPort *> wirelessTxInputPorts(const QVector<GraphicElement *> &elements);
205 const QVector<GraphicElement *> visibleElements() const;
206
211 static bool isConnectionAllowed(OutputPort *startPort, InputPort *endPort);
212
215 void showStatusMessage(const QString &message);
216
217 // --- Connection Manager ---
218
220 ConnectionManager *connectionManager() { return &m_connectionManager; }
221
222 // --- Clipboard Manager ---
223
225 ClipboardManager *clipboardManager() { return &m_clipboardManager; }
226
227 // --- Property Shortcut Handler ---
228
230 PropertyShortcutHandler *propertyShortcutHandler() { return &m_propertyShortcutHandler; }
231
232 // --- Hit-testing ---
233
235 QGraphicsItem *itemAt(QPointF pos) const;
236
240 [[nodiscard]] Port *portAt(QPointF pos) const;
241
243 [[nodiscard]] QPointF mousePos() const { return m_interaction.lastMousePos(); }
244
246 void contextMenu(const QPoint screenPos);
247
248 // --- Adding Items ---
249
253 void addItem(QMimeData *mimeData, std::optional<QPointF> scenePos = std::nullopt);
254
255 // --- Clipboard (Copy / Cut / Paste) ---
256
258 void copyAction();
260 void cutAction();
262 void pasteAction();
264 void duplicateAction();
265
266 // --- Element Operations (Rotate / Flip / Delete / Mute) ---
267
269 void deleteAction();
271 void rotateRight();
273 void rotateLeft();
275 void flipHorizontally();
277 void flipVertically();
278
279 // --- Element Operations (Align / Distribute) ---
280
282 void alignLeft();
284 void alignRight();
286 void alignTop();
288 void alignBottom();
294 void alignVerticalCenter();
301
303 void mute(const bool mute = true);
305 void selectAll();
306
307 // --- Element Property Cycling ---
308
310 void nextElm();
312 void prevElm();
321
322 // --- Undo / Redo ---
323
325 QUndoStack *undoStack();
327 QAction *redoAction() const;
329 QAction *undoAction() const;
331 void receiveCommand(QUndoCommand *cmd);
332
333 // --- Simulation ---
334
343
345 QList<QGraphicsItem *> simulationItems() const override { return items(); }
347 void setMuted(const bool muted) override { mute(muted); }
348
349 // --- Context Directory ---
350
352 QString contextDir() const override { return m_contextDir; }
354 void setContextDir(const QString &dir) { m_contextDir = dir; }
355
356 // --- IC Registry ---
357
359 ICRegistry *icRegistry() { return &m_icRegistry; }
360
364 SerializationContext deserializationContext(QHash<quint64, Port *> &portMap, const QVersionNumber &version, SerializationPurpose purpose);
365
366 // --- Autosave ---
367
369 void setAutosaveRequired();
370
371 // --- Theme ---
372
374 void updateTheme();
375
376 // --- Retranslation ---
377
379 void retranslateUi();
380
381 // --- Event Filter ---
382
384 bool eventFilter(QObject *watched, QEvent *event) override;
385
386signals:
387 // --- Signals ---
388
391
397 void contextMenuPos(QPoint screenPos, QGraphicsItem *itemAtMouse);
398
404
406 void icOpenRequested(int elementId, const QString &blobName, const QString &filePath);
407
409 void fileDropRequested(const QString &filePath);
410
413 void showStatusMessageRequested(const QString &message);
414
415 // --- IC hover-preview lifecycle (re-emitted from IC; see SceneUiBinder) ---
416 void icPreviewRequested(IC *ic, const QPoint &screenPos);
417 void icPreviewMoved(IC *ic, const QPoint &screenPos);
420
423
424protected:
425 // --- Qt event overrides ---
426
428 void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
430 void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
432 void dropEvent(QGraphicsSceneDragDropEvent *event) override;
434 void keyPressEvent(QKeyEvent *event) override;
436 void keyReleaseEvent(QKeyEvent *event) override;
438 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
440 void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
442 void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
444 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
446 void helpEvent(QGraphicsSceneHelpEvent *event) override;
447
448private:
449 // --- Helpers ---
450
453 bool nudgeSelection(QKeyEvent *event);
454 QList<QGraphicsItem *> itemsAt(const QPointF pos) const;
455 const QVector<Connection *> connections() const;
456 void checkUpdateRequest();
457 void updateUndoText(const QString &text);
458 void updateRedoText(const QString &text);
459 void drawBackground(QPainter *painter, const QRectF &rect) override;
460 void rotate(const int angle);
461 void setDots(const QPen &dots);
462
464 void registerItem(ItemWithId *item);
466 void unregisterItem(ItemWithId *item);
467
468 // --- Members ---
469
470 // View
471 GraphicsView *m_view = nullptr;
472
473 // Undo/redo
474 QUndoStack m_undoStack;
475 QAction *m_redoAction;
476 QAction *m_undoAction;
477
478 // Simulation
479 Simulation m_simulation;
480
481 // Per-scene element registry (delegated to SceneItemRegistry)
482 SceneItemRegistry m_itemRegistry;
483
484 // Rendering
485 QPen m_dots;
486
487 // Mouse-move re-entrancy guard. Stays on Scene (not SceneInteraction) because it
488 // must wrap the base QGraphicsScene::mouseMoveEvent call, where the re-entrancy
489 // (ensureVisible → replayLastMouseEvent → mouseMoveEvent) actually originates.
490 bool m_handlingMouseMove = false;
491
492 // Context directory (directory of the .panda file owning this scene)
493 QString m_contextDir;
494
495 // IC definition registry (caches definitions, manages file watching)
496 ICRegistry m_icRegistry = ICRegistry(this);
497
498 // Autosave
499 bool m_autosaveRequired = false;
500
501 // Connection editing (delegated to ConnectionManager)
502 ConnectionManager m_connectionManager = ConnectionManager(this);
503
504 // Clipboard operations (delegated to ClipboardManager)
505 ClipboardManager m_clipboardManager = ClipboardManager(this);
506
507 // Property shortcut dispatch (delegated to PropertyShortcutHandler)
508 PropertyShortcutHandler m_propertyShortcutHandler = PropertyShortcutHandler(this);
509
510 // Visibility control (delegated to VisibilityManager)
511 VisibilityManager m_visibilityManager = VisibilityManager(this);
512
513 // Set by setPropertyUpdateRequired() whenever a structural edit may have left some
514 // item's visibility out of sync with the current show-wires/show-gates toggles;
515 // reapplied lazily in drawBackground() (see its comment) rather than eagerly.
516 bool m_visibilityDirty = false;
517
518 // Backing cache for cachedItemsBoundingRect(); mutable since the accessor is const.
519 // Set dirty by setPropertyUpdateRequired(), the same chokepoint every structural/
520 // positional edit already funnels through.
521 mutable QRectF m_cachedItemsBoundingRect;
522 mutable bool m_itemsBoundingRectDirty = true;
523
524 // Adaptive wire antialiasing (see the public accessors' comment): consecutive-pass
525 // counters for the debounced degrade and the sustained-headroom restore; the idle
526 // timer's timeout re-checks m_wireActivityTimer (deadline pattern) and either
527 // restores or re-arms for the remaining window, so per-flip timer restarts are
528 // never needed.
529 bool m_wireAntialiasing = true;
530 int m_wireAaSlowPasses = 0;
531 int m_wireAaHeadroomPasses = 0;
532 QTimer m_wireAaIdleTimer;
533 QElapsedTimer m_wireFlipTimer;
534 QElapsedTimer m_wirePassTimer;
535
537 void checkWireIdleRestore();
538
539 // Drag-and-drop payload decoding (delegated to SceneDropHandler)
540 SceneDropHandler m_dropHandler = SceneDropHandler(this);
541
542 // On-canvas inline label rename/edit (delegated to InlineLabelEditor)
543 InlineLabelEditor m_inlineLabelEditor = InlineLabelEditor(this);
544
545 // Mouse-driven editing gestures + rubber-band selection (delegated to SceneInteraction)
546 SceneInteraction m_interaction{this};
547};
ClipboardManager: handles copy, cut, paste and clone-drag operations.
ConnectionManager: manages wire creation, deletion, validation and hover feedback.
Interface for resolving a scene's associated .panda file directory.
IC definition registry with file watching and embedded blob storage.
InlineLabelEditor: on-canvas inline editing of an element's label.
Port classes: Port (base), InputPort, and OutputPort.
PropertyShortcutHandler: dispatches keyboard shortcuts that cycle element properties.
SceneDropHandler: decodes drag-and-drop payloads into scene elements.
SceneInteraction: owns the scene's mouse-driven editing state and gestures.
SceneItemRegistry: maps stable integer IDs to the scene's identifiable items.
SerializationPurpose
What a serialization operation is for – shared by both load() and save(), so the same distinction is ...
Interface exposing the narrow slice of Scene that Simulation depends on.
Synchronous cycle-based simulation engine with event-driven clock support.
VisibilityManager: controls gate and wire visibility in the scene.
Manages clipboard operations (copy/cut/paste) and clone-drag for the circuit scene.
Manages interactive wire creation, deletion, validation and hover feedback.
A bezier-curve wire connecting an output port to an input port in the scene.
Definition Connection.h:38
Narrow interface exposing a scene's context directory.
Abstract base class for all graphical circuit elements in wiRedPanda.
Extended QGraphicsView with enhanced navigation capabilities.
Manages IC definitions, file watching, and embedded blob storage.
Definition ICRegistry.h:30
Graphic element representing an Integrated Circuit (sub-circuit) box.
Definition IC.h:31
Hosts a temporary QLineEdit directly on the canvas to rename an element's label in place,...
A port that receives a signal (the destination end of a wire).
Definition Port.h:229
Base class providing a unique integer identifier for circuit items.
Definition ItemWithId.h:31
A port that drives a signal (the source end of a wire).
Definition Port.h:261
Abstract base class for circuit element ports (connection endpoints).
Definition Port.h:39
Dispatches keyboard shortcuts that cycle element properties and types.
Decodes wiRedPanda drag-and-drop payloads (new element from the palette, and clone-drag of an existin...
Owns the interactive editing state of a Scene — element dragging, the rubber-band selection rectangle...
Owns the id↔item bookkeeping for a Scene: the id-to-item map and the monotonically increasing last-as...
void flipHorizontally()
Flips selected elements horizontally.
Definition Scene.cpp:893
void truthTableElementChanged(GraphicElement *element)
Emitted after a TruthTable element's output bit is toggled (redo or undo).
const QVector< GraphicElement * > elements() const
Returns all graphic elements in the scene.
Definition Scene.cpp:336
void alignBottom()
Aligns selected elements' bottom edges to the bottommost selected edge. No-op below 2 elements.
Definition Scene.cpp:1001
void icPreviewRequested(IC *ic, const QPoint &screenPos)
void restoreWireAntialiasing()
Definition Scene.cpp:599
void setLastId(int newLastId)
Advances the scene's ID counter to at least newLastId.
Definition Scene.cpp:186
void dropEvent(QGraphicsSceneDragDropEvent *event) override
Definition Scene.cpp:1182
void recordWirePaintPass(qint64 elapsedNs)
Definition Scene.cpp:549
void pasteAction()
Pastes items from the internal clipboard into the scene.
Definition Scene.cpp:826
void fileDropRequested(const QString &filePath)
Emitted when a .panda file is dropped onto the canvas from the file manager.
QRectF cachedItemsBoundingRect() const
Definition Scene.cpp:527
void resizeScene()
Tightens the scene rect to item bounds while preserving the viewport position.
Definition Scene.cpp:635
bool wireAntialiasingEnabled() const
true while wires should stroke with antialiasing; Connection::paint() consults this.
Definition Scene.cpp:544
void keyPressEvent(QKeyEvent *event) override
Definition Scene.cpp:1249
VisibilityManager * visibilityManager()
Returns the visibility manager for this scene.
Definition Scene.h:173
void nextSecndPropShortcut()
Advances the secondary property of selected elements to the next value.
Definition Scene.cpp:693
void showStatusMessageRequested(const QString &message)
GraphicsView * view() const
Returns the GraphicsView currently displaying this scene.
Definition Scene.cpp:743
void contextMenuPos(QPoint screenPos, QGraphicsItem *itemAtMouse)
Emitted when a context menu should appear.
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Definition Scene.cpp:1327
bool eventFilter(QObject *watched, QEvent *event) override
Definition Scene.cpp:1301
void alignRight()
Aligns selected elements' right edges to the rightmost selected edge. No-op below 2 elements.
Definition Scene.cpp:957
void setCircuitUpdateRequired()
Marks the simulation mapping as stale so it is rebuilt on the next tick.
Definition Scene.cpp:298
Port * portAt(QPointF pos) const
Definition Scene.cpp:480
PropertyShortcutHandler * propertyShortcutHandler()
Returns the handler for keyboard shortcuts that cycle element properties.
Definition Scene.h:230
void prevElm()
Cycles selection backward to the previous element.
Definition Scene.cpp:697
void forgetItemId(int id)
Definition Scene.cpp:201
void removeItem(QGraphicsItem *item)
Removes item from the scene and unregisters it from the per-scene ID registry.
Definition Scene.cpp:160
void copyAction()
Copies the selected items to the internal clipboard.
Definition Scene.cpp:814
QAction * redoAction() const
Returns the redo QAction bound to the undo stack.
Definition Scene.cpp:758
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 showStatusMessage(const QString &message)
Definition Scene.cpp:682
void icPreviewMoved(IC *ic, const QPoint &screenPos)
static QHash< QString, InputPort * > wirelessTxInputPorts(const QVector< GraphicElement * > &elements)
Returns a map from wireless channel label to the Tx node's input port.
Definition Scene.cpp:399
void rotateLeft()
Rotates selected elements 90 degrees counter-clockwise.
Definition Scene.cpp:869
void receiveCommand(QUndoCommand *cmd)
Pushes cmd onto the undo stack (immediately executes its redo()).
Definition Scene.cpp:520
int lastId() const
Returns the current highest ID in use by this scene.
Definition Scene.cpp:181
QList< QGraphicsItem * > simulationItems() const override
Definition Scene.h:345
void contextMenu(const QPoint screenPos)
Opens the element/selection context menu at screenPos (driven by SceneInteraction on right-click).
Definition Scene.cpp:781
const QList< GraphicElement * > selectedElements() const
Returns the list of currently selected graphic elements.
Definition Scene.cpp:427
static bool isConnectionAllowed(OutputPort *startPort, InputPort *endPort)
Returns true if a wire from startPort to endPort is permitted.
Definition Scene.cpp:677
void distributeVertically()
Definition Scene.cpp:1106
void noteWireActivity()
Definition Scene.cpp:578
void duplicateAction()
Duplicates the selection in place (leaves the system clipboard untouched).
Definition Scene.cpp:832
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Definition Scene.cpp:1355
QString contextDir() const override
Returns the directory of the .panda file associated with this scene.
Definition Scene.h:352
void icPreviewCancelRequested(IC *ic)
void prevMainPropShortcut()
Retreats the main property of selected elements to the previous value.
Definition Scene.cpp:687
void prevSecndPropShortcut()
Retreats the secondary property of selected elements to the previous value.
Definition Scene.cpp:691
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override
Definition Scene.cpp:1160
void setAutosaveRequired()
Schedules an autosave of the current circuit state.
Definition Scene.cpp:293
bool contains(int id) const
Returns true if an item with id is registered in this scene.
Definition Scene.cpp:176
void selectAll()
Selects all items in the scene.
Definition Scene.cpp:854
QGraphicsItem * itemAt(QPointF pos) const
Returns the topmost item at pos, prioritising ports over elements.
Definition Scene.cpp:441
ItemWithId * itemById(int id) const
Returns the item registered under id, or nullptr if not found.
Definition Scene.cpp:171
void rotateRight()
Rotates selected elements 90 degrees clockwise.
Definition Scene.cpp:863
void alignVerticalCenter()
Definition Scene.cpp:1046
static QVector< GraphicElement * > sortByTopology(QVector< GraphicElement * > elements)
Returns elements sorted in topological dependency order (inputs first).
Definition Scene.cpp:371
void setPropertyUpdateRequired()
Definition Scene.cpp:313
void retranslateUi()
Updates undo/redo action text to reflect the current UI language.
Definition Scene.cpp:763
ConnectionManager * connectionManager()
Returns the connection manager that handles wire creation, deletion, and hover feedback.
Definition Scene.h:220
void flipVertically()
Flips selected elements vertically.
Definition Scene.cpp:903
void addItem(QGraphicsItem *item)
Adds item to the scene and registers it in the per-scene ID registry.
Definition Scene.cpp:119
ClipboardManager * clipboardManager()
Returns the clipboard manager that handles copy, cut, paste and clone-drag.
Definition Scene.h:225
void mute(const bool mute=true)
Mutes or unmutes selected elements according to mute.
Definition Scene.cpp:884
void keyReleaseEvent(QKeyEvent *event) override
Definition Scene.cpp:1278
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
Definition Scene.cpp:1334
void showWires(bool checked)
Shows or hides connection wires. Delegates to VisibilityManager.
Definition Scene.cpp:738
void nextMainPropShortcut()
Advances the main property of selected elements to the next value.
Definition Scene.cpp:689
void nextElm()
Cycles selection forward to the next element.
Definition Scene.cpp:695
void icPreviewHideRequested()
ICRegistry * icRegistry()
Returns the IC definition registry for this scene.
Definition Scene.h:359
void deleteAction()
Deletes the currently selected items.
Definition Scene.cpp:838
void helpEvent(QGraphicsSceneHelpEvent *event) override
Definition Scene.cpp:1369
int nextId()
Returns the next available scene-local ID (does not assign it).
Definition Scene.cpp:191
Scene(QObject *parent=nullptr)
Constructs a Scene and initialises the undo stack and simulation.
Definition Scene.cpp:69
void alignTop()
Aligns selected elements' top edges to the topmost selected edge. No-op below 2 elements.
Definition Scene.cpp:979
QList< QGraphicsItem * > items(Qt::SortOrder order=Qt::AscendingOrder) const
Definition Scene.cpp:718
void alignLeft()
Aligns selected elements' left edges to the leftmost selected edge. No-op below 2 elements.
Definition Scene.cpp:935
void updateItemId(ItemWithId *item, int newId)
Reassigns the ID of item to newId without adding it to the scene.
Definition Scene.cpp:196
void circuitHasChanged()
Emitted whenever the circuit changes (element added/removed/moved).
static QString droppedPandaFile(const QMimeData *mimeData)
Definition Scene.cpp:1143
void distributeHorizontally()
Definition Scene.cpp:1069
void openTruthTableRequested()
Emitted when a TruthTable element is double-clicked to request opening its editor.
void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override
Definition Scene.cpp:1171
void showGates(bool checked)
Shows or hides gate elements. Delegates to VisibilityManager.
Definition Scene.cpp:733
void alignHorizontalCenter()
Definition Scene.cpp:1023
const QVector< GraphicElement * > visibleElements() const
Returns all visible (non-hidden) graphic elements in the scene.
Definition Scene.cpp:329
void updateTheme()
Propagates the current theme to all elements and connections.
Definition Scene.cpp:699
SerializationContext deserializationContext(QHash< quint64, Port * > &portMap, const QVersionNumber &version, SerializationPurpose purpose)
Definition Scene.cpp:216
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
Definition Scene.cpp:1362
QPointF mousePos() const
Returns the last known mouse position in scene coordinates.
Definition Scene.h:243
void setMuted(const bool muted) override
Definition Scene.h:347
void cutAction()
Cuts the selected items to the internal clipboard.
Definition Scene.cpp:820
const QVector< GraphicElement * > unsortedElements() const
Definition Scene.cpp:341
void setContextDir(const QString &dir)
Sets the directory of the .panda file associated with this scene.
Definition Scene.h:354
void setView(GraphicsView *view)
Sets the GraphicsView that displays this scene to view.
Definition Scene.cpp:748
QAction * undoAction() const
Returns the undo QAction bound to the undo stack.
Definition Scene.cpp:753
Simulation * simulation()
Returns the simulation engine associated with this scene.
Definition Scene.cpp:288
QUndoStack * undoStack()
Returns the scene's undo stack.
Definition Scene.cpp:672
Narrow interface letting Simulation reach its host scene without naming the concrete Scene class.
Manages the digital circuit simulation loop.
Definition Simulation.h:38
Controls the visibility of gates, wires, and port handles in the circuit scene.
Bundles all per-deserialization state so that load() overrides receive it through one explicit parame...