wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
SceneInteraction Class Reference

Owns the interactive editing state of a Scene — element dragging, the rubber-band selection rectangle, and the last cursor position — and implements the press/move/release/double-click gestures. More...

#include <SceneInteraction.h>

Public Member Functions

void applyTheme (const ThemeAttributes &theme)
 Applies the theme's selection-rectangle brush and pen.
void attachToScene ()
bool isDraggingElement () const
 true while an element drag is in progress (drives Scene::resizeScene's expand-only mode).
QPointF lastMousePos () const
 Last known cursor position in scene coordinates.
bool mouseDoubleClick (QGraphicsSceneMouseEvent *event)
bool mouseMove (QGraphicsSceneMouseEvent *event)
bool mousePress (QGraphicsSceneMouseEvent *event)
bool mouseRelease (QGraphicsSceneMouseEvent *event)
 SceneInteraction (Scene *scene)

Detailed Description

Owns the interactive editing state of a Scene — element dragging, the rubber-band selection rectangle, and the last cursor position — and implements the press/move/release/double-click gestures.

Extracted from Scene via ownership inversion, mirroring ConnectionManager: it holds the drag snapshot, selection-box state and the selection-rect item, and calls back to the Scene only for genuine scene operations (itemAt, selectedElements, receiveCommand, resizeScene, contextMenu, the connection manager). The gesture methods return true when the event is fully handled so Scene skips the base-class call. (The mouse-move re-entrancy guard stays on Scene because it must wrap Scene's own base-event call.)

Definition at line 37 of file SceneInteraction.h.

Constructor & Destructor Documentation

◆ SceneInteraction()

SceneInteraction::SceneInteraction ( Scene * scene)
explicit

Definition at line 23 of file SceneInteraction.cpp.

Member Function Documentation

◆ applyTheme()

void SceneInteraction::applyTheme ( const ThemeAttributes & theme)

Applies the theme's selection-rectangle brush and pen.

Definition at line 39 of file SceneInteraction.cpp.

References ThemeAttributes::m_selectionBrush, and ThemeAttributes::m_selectionPen.

◆ attachToScene()

void SceneInteraction::attachToScene ( )

Adds the selection rectangle to the scene and starts the drag throttle timer. Called from the Scene constructor body to preserve the original init order.

Definition at line 28 of file SceneInteraction.cpp.

◆ isDraggingElement()

bool SceneInteraction::isDraggingElement ( ) const
inlinenodiscard

true while an element drag is in progress (drives Scene::resizeScene's expand-only mode).

Definition at line 59 of file SceneInteraction.h.

◆ lastMousePos()

QPointF SceneInteraction::lastMousePos ( ) const
inlinenodiscard

Last known cursor position in scene coordinates.

Definition at line 56 of file SceneInteraction.h.

◆ mouseDoubleClick()

bool SceneInteraction::mouseDoubleClick ( QGraphicsSceneMouseEvent * event)
Returns
true if the double-click was fully handled (caller skips the base call).

Definition at line 229 of file SceneInteraction.cpp.

◆ mouseMove()

bool SceneInteraction::mouseMove ( QGraphicsSceneMouseEvent * event)
Returns
true if the move was fully handled (caller skips the base call).

Definition at line 133 of file SceneInteraction.cpp.

◆ mousePress()

bool SceneInteraction::mousePress ( QGraphicsSceneMouseEvent * event)
Returns
true if the press was fully handled (caller skips the base call).

Definition at line 54 of file SceneInteraction.cpp.

References sentryBreadcrumb(), GraphicElement::Type, and Port::Type.

◆ mouseRelease()

bool SceneInteraction::mouseRelease ( QGraphicsSceneMouseEvent * event)
Returns
true if the release was fully handled (caller skips the base call).

Definition at line 170 of file SceneInteraction.cpp.

References sentryBreadcrumb().


The documentation for this class was generated from the following files: