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
59 // Ctrl-modifier QGraphicsSceneMouseEvents synthesized via QTest don't reliably carry
60 // the modifier through this sandbox's event pipeline (see the coverage tracking doc's
61 // "recurring exclusion patterns" #22) -- lets tests call the protected mouse handlers
62 // directly with a hand-built event instead of chasing unreliable synthetic input.
63 friend class TestScene;
64
65public:
67 void addItem(QGraphicsItem *item);
68
70 void removeItem(QGraphicsItem *item);
71
73 void resizeScene();
74
81 [[nodiscard]] QRectF cachedItemsBoundingRect() const;
82
83 // --- Adaptive wire antialiasing ---
84 //
85 // Antialiased wire strokes cost ~5x the raster time of plain ones, and on a large clocked
86 // circuit the simulation recolours wires across the whole viewport continuously -- each
87 // repaint pass re-strokes every visible wire, pinning the GUI thread. Quality adapts with
88 // the standard split used for binary quality knobs elsewhere (game-engine dynamic
89 // resolution scaling degrades on the measured frame-time budget; browsers, GIS canvases
90 // and EDA tools restore full quality when the activity causing the load stops):
91 //
92 // 1. Degrade: wire antialiasing turns off when the measured pass time stays over budget
93 // (debounced, so a one-off compositor stall or load spike never triggers).
94 // 2. Restore on idle: antialiasing returns (plus one refinement repaint, free by
95 // definition on an idle view) once BOTH activity streams have gone quiet -- paint
96 // passes for a short window (an interaction gesture ended), and wire status flips
97 // for a longer window (clock-driven flips arrive in bursts at each clock edge, so
98 // the window must span inter-edge gaps -- seconds for slow educational clocks --
99 // or the restore fires inside a gap and quality oscillates with the clock).
100 // Neither stream alone suffices: pass cadence is bursty mid-storm, and flips stop
101 // entirely on combinational circuits whose simulation still runs.
102 // 3. Restore on sustained deep headroom: a light workload that never goes idle (small
103 // region in view while the simulation runs) restores once passes stay under
104 // budget / worst-case-AA-ratio, which bounds the restored antialiased pass to within
105 // budget by construction.
106 //
107 // Restoration deliberately never keys on the degraded renderer merely being "fast enough":
108 // with a binary knob that measured speed is a consequence of the decision itself and
109 // oscillates quality at the pass rate. Only wires change quality -- elements, ports and
110 // text keep the view's render hints.
111
113 [[nodiscard]] bool wireAntialiasingEnabled() const;
114
117 void recordWirePaintPass(qint64 elapsedNs);
118
121 void noteWireActivity();
122
127
128 // --- Per-Scene Element Registry ---
129
131 [[nodiscard]] ItemWithId *itemById(int id) const;
132
134 [[nodiscard]] bool contains(int id) const;
135
137 int lastId() const;
138
140 void setLastId(int newLastId);
141
143 int nextId();
144
151 void updateItemId(ItemWithId *item, int newId);
152
158 void forgetItemId(int id);
159
160 // --- Lifecycle ---
161
163 explicit Scene(QObject *parent = nullptr);
164
165 // --- View / Display Management ---
166
168 GraphicsView *view() const;
171
173 void showGates(bool checked);
174
176 void showWires(bool checked);
177
179 VisibilityManager *visibilityManager() { return &m_visibilityManager; }
180
181 // --- Element Access / Queries ---
182
184 QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const;
186 QList<QGraphicsItem *> items(QPointF pos, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::AscendingOrder, const QTransform &deviceTransform = QTransform()) const;
188 QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::AscendingOrder, const QTransform &deviceTransform = QTransform()) const;
190 const QList<GraphicElement *> selectedElements() const;
192 const QVector<GraphicElement *> elements() const;
194 const QVector<GraphicElement *> elements(const QRectF &rect) const;
197 static QString droppedPandaFile(const QMimeData *mimeData);
200 const QVector<GraphicElement *> unsortedElements() const;
202 static QVector<GraphicElement *> sortByTopology(QVector<GraphicElement *> elements);
209 static QHash<QString, InputPort *> wirelessTxInputPorts(const QVector<GraphicElement *> &elements);
211 const QVector<GraphicElement *> visibleElements() const;
212
217 static bool isConnectionAllowed(OutputPort *startPort, InputPort *endPort);
218
221 void showStatusMessage(const QString &message);
222
223 // --- Connection Manager ---
224
226 ConnectionManager *connectionManager() { return &m_connectionManager; }
227
228 // --- Clipboard Manager ---
229
231 ClipboardManager *clipboardManager() { return &m_clipboardManager; }
232
233 // --- Property Shortcut Handler ---
234
236 PropertyShortcutHandler *propertyShortcutHandler() { return &m_propertyShortcutHandler; }
237
238 // --- Hit-testing ---
239
241 QGraphicsItem *itemAt(QPointF pos) const;
242
246 [[nodiscard]] Port *portAt(QPointF pos) const;
247
249 [[nodiscard]] QPointF mousePos() const { return m_interaction.lastMousePos(); }
250
252 void contextMenu(const QPoint screenPos);
253
254 // --- Adding Items ---
255
259 void addItem(QMimeData *mimeData, std::optional<QPointF> scenePos = std::nullopt);
260
261 // --- Clipboard (Copy / Cut / Paste) ---
262
264 void copyAction();
266 void cutAction();
268 void pasteAction();
270 void duplicateAction();
271
272 // --- Element Operations (Rotate / Flip / Delete / Mute) ---
273
275 void deleteAction();
277 void rotateRight();
279 void rotateLeft();
281 void flipHorizontally();
283 void flipVertically();
284
285 // --- Element Operations (Align / Distribute) ---
286
288 void alignLeft();
290 void alignRight();
292 void alignTop();
294 void alignBottom();
300 void alignVerticalCenter();
307
309 void mute(const bool mute = true);
311 void selectAll();
312
313 // --- Element Property Cycling ---
314
316 void nextElm();
318 void prevElm();
327
328 // --- Undo / Redo ---
329
331 QUndoStack *undoStack();
333 QAction *redoAction() const;
335 QAction *undoAction() const;
337 void receiveCommand(QUndoCommand *cmd);
338
339 // --- Simulation ---
340
349
351 QList<QGraphicsItem *> simulationItems() const override { return items(); }
353 void setMuted(const bool muted) override { mute(muted); }
354
355 // --- Context Directory ---
356
358 QString contextDir() const override { return m_contextDir; }
360 void setContextDir(const QString &dir) { m_contextDir = dir; }
361
362 // --- IC Registry ---
363
365 ICRegistry *icRegistry() { return &m_icRegistry; }
366
370 SerializationContext deserializationContext(QHash<quint64, Port *> &portMap, const QVersionNumber &version, SerializationPurpose purpose);
371
372 // --- Autosave ---
373
375 void setAutosaveRequired();
376
377 // --- Theme ---
378
380 void updateTheme();
381
382 // --- Retranslation ---
383
385 void retranslateUi();
386
387 // --- Event Filter ---
388
390 bool eventFilter(QObject *watched, QEvent *event) override;
391
392signals:
393 // --- Signals ---
394
397
403 void contextMenuPos(QPoint screenPos, QGraphicsItem *itemAtMouse);
404
410
412 void icOpenRequested(int elementId, const QString &blobName, const QString &filePath);
413
415 void fileDropRequested(const QString &filePath);
416
419 void showStatusMessageRequested(const QString &message);
420
421 // --- IC hover-preview lifecycle (re-emitted from IC; see SceneUiBinder) ---
422 void icPreviewRequested(IC *ic, const QPoint &screenPos);
423 void icPreviewMoved(IC *ic, const QPoint &screenPos);
426
429
430protected:
431 // --- Qt event overrides ---
432
434 void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
436 void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
438 void dropEvent(QGraphicsSceneDragDropEvent *event) override;
440 void keyPressEvent(QKeyEvent *event) override;
442 void keyReleaseEvent(QKeyEvent *event) override;
444 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
446 void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
448 void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
450 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
452 void helpEvent(QGraphicsSceneHelpEvent *event) override;
453
454private:
455 // --- Helpers ---
456
459 bool nudgeSelection(QKeyEvent *event);
460 QList<QGraphicsItem *> itemsAt(const QPointF pos) const;
461 const QVector<Connection *> connections() const;
462 void checkUpdateRequest();
463 void updateUndoText(const QString &text);
464 void updateRedoText(const QString &text);
465 void drawBackground(QPainter *painter, const QRectF &rect) override;
466 void rotate(const int angle);
467 void setDots(const QPen &dots);
468
470 void registerItem(ItemWithId *item);
472 void unregisterItem(ItemWithId *item);
473
474 // --- Members ---
475
476 // View
477 GraphicsView *m_view = nullptr;
478
479 // Undo/redo
480 QUndoStack m_undoStack;
481 QAction *m_redoAction;
482 QAction *m_undoAction;
483
484 // Simulation
485 Simulation m_simulation;
486
487 // Per-scene element registry (delegated to SceneItemRegistry)
488 SceneItemRegistry m_itemRegistry;
489
490 // Rendering
491 QPen m_dots;
492
493 // Mouse-move re-entrancy guard. Stays on Scene (not SceneInteraction) because it
494 // must wrap the base QGraphicsScene::mouseMoveEvent call, where the re-entrancy
495 // (ensureVisible → replayLastMouseEvent → mouseMoveEvent) actually originates.
496 bool m_handlingMouseMove = false;
497
498 // Context directory (directory of the .panda file owning this scene)
499 QString m_contextDir;
500
501 // IC definition registry (caches definitions, manages file watching)
502 ICRegistry m_icRegistry = ICRegistry(this);
503
504 // Autosave
505 bool m_autosaveRequired = false;
506
507 // Connection editing (delegated to ConnectionManager)
508 ConnectionManager m_connectionManager = ConnectionManager(this);
509
510 // Clipboard operations (delegated to ClipboardManager)
511 ClipboardManager m_clipboardManager = ClipboardManager(this);
512
513 // Property shortcut dispatch (delegated to PropertyShortcutHandler)
514 PropertyShortcutHandler m_propertyShortcutHandler = PropertyShortcutHandler(this);
515
516 // Visibility control (delegated to VisibilityManager)
517 VisibilityManager m_visibilityManager = VisibilityManager(this);
518
519 // Set by setPropertyUpdateRequired() whenever a structural edit may have left some
520 // item's visibility out of sync with the current show-wires/show-gates toggles;
521 // reapplied lazily in drawBackground() (see its comment) rather than eagerly.
522 bool m_visibilityDirty = false;
523
524 // Backing cache for cachedItemsBoundingRect(); mutable since the accessor is const.
525 // Set dirty by setPropertyUpdateRequired(), the same chokepoint every structural/
526 // positional edit already funnels through.
527 mutable QRectF m_cachedItemsBoundingRect;
528 mutable bool m_itemsBoundingRectDirty = true;
529
530 // Adaptive wire antialiasing (see the public accessors' comment): consecutive-pass
531 // counters for the debounced degrade and the sustained-headroom restore; the idle
532 // timer's timeout re-checks m_wireActivityTimer (deadline pattern) and either
533 // restores or re-arms for the remaining window, so per-flip timer restarts are
534 // never needed.
535 bool m_wireAntialiasing = true;
536 int m_wireAaSlowPasses = 0;
537 int m_wireAaHeadroomPasses = 0;
538 QTimer m_wireAaIdleTimer;
539 QElapsedTimer m_wireFlipTimer;
540 QElapsedTimer m_wirePassTimer;
541
543 void checkWireIdleRestore();
544
545 // Drag-and-drop payload decoding (delegated to SceneDropHandler)
546 SceneDropHandler m_dropHandler = SceneDropHandler(this);
547
548 // On-canvas inline label rename/edit (delegated to InlineLabelEditor)
549 InlineLabelEditor m_inlineLabelEditor = InlineLabelEditor(this);
550
551 // Mouse-driven editing gestures + rubber-band selection (delegated to SceneInteraction)
552 SceneInteraction m_interaction{this};
553};
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:234
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:266
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
friend class TestScene
Definition Scene.h:63
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:179
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:236
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:351
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:358
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:226
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:231
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:365
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:249
void setMuted(const bool muted) override
Definition Scene.h:353
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:360
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:39
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...