3#include <QGraphicsView>
7#include "widgets/settings_manager.h"
51 void zoom(
float scaleFactor);
65 void centerOn(
const QGraphicsItem* item);
123 void drawBackground(QPainter* painter,
const QRectF& rect)
override;
void resetZoom()
Resets the view to its default scale.
Definition canvas_view.cpp:170
void keyPressEvent(QKeyEvent *) override
Overrides the key press event to handle zoom and pan controls.
Definition canvas_view.cpp:76
qreal mMaxZoom
Maximum allowed zoom level.
Definition canvas_view.h:148
bool mShowGrid
Flag to show the grid on the canvas.
Definition canvas_view.h:133
void zoomOut()
Zooms out by applying a zoom factor of 1 - mZoomDelta.
Definition canvas_view.cpp:165
CanvasView(QWidget *parent=nullptr)
Constructs a new CanvasView object.
Definition canvas_view.cpp:11
void keyReleaseEvent(QKeyEvent *) override
Overrides the key release event to handle zoom and pan controls.
Definition canvas_view.cpp:104
void wheelEvent(QWheelEvent *) override
Overrides the wheel event to handle zooming.
Definition canvas_view.cpp:152
void onSettingsChanged(const AppearanceSettings &settings)
Handles settings changes, specifically for appearance settings.
Definition canvas_view.cpp:57
QPoint mLastMousePos
Last mouse position for panning.
Definition canvas_view.h:136
void mouseMoveEvent(QMouseEvent *) override
Overrides the mouse move event to handle panning.
Definition canvas_view.cpp:112
bool mDoKeyZoom
Flag to determine if key-based zooming is active.
Definition canvas_view.h:130
void centerOn(const QPointF &pos)
Centers the view on a specific position.
Definition canvas_view.cpp:52
void setScale(qreal scale)
Sets the scale factor of the view.
Definition canvas_view.cpp:62
qreal quantisedScale(qreal proposedScale) const
Quantises the proposed scale to ensure it is within valid limits and aligned with grid size.
Definition canvas_view.cpp:194
void mousePressEvent(QMouseEvent *) override
Overrides the mouse press event to start panning or zooming.
Definition canvas_view.cpp:129
qreal mZoomKey
Key used for zooming.
Definition canvas_view.h:142
void setMaxSize()
Sets the maximum size of the view's scene rectangle.
Definition canvas_view.cpp:71
Qt::MouseButton mPanButton
Mouse button used for panning.
Definition canvas_view.h:151
void zoom(float scaleFactor)
Zooms in by a given scale factor.
Definition canvas_view.cpp:178
QPointF getCenter() const
Gets the current center point of the view.
Definition canvas_view.cpp:42
bool mDoMousePanning
Flags to determine if zooming or panning should be done.
Definition canvas_view.h:127
void zoomIn()
Zooms in by applying a zoom factor of 1 + mZoomDelta.
Definition canvas_view.cpp:160
qreal mZoomDelta
Delta value for zooming.
Definition canvas_view.h:139
qreal getScale() const
Gets the current scale factor of the view.
Definition canvas_view.cpp:37
void drawBackground(QPainter *painter, const QRectF &rect) override
Draws the background of the view, including a grid if enabled.
Definition canvas_view.cpp:206
qreal mMinZoom
Minimum allowed zoom level.
Definition canvas_view.h:145
void mouseReleaseEvent(QMouseEvent *) override
Overrides the mouse release event to stop panning.
Definition canvas_view.cpp:141
The Canvas class represents the main drawing area for nodes and transitions.
Definition canvas.h:29
Holds appearance settings.
Definition settings_manager.h:49