Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
PluginView Class Reference

Custom QGraphicsView for plugin functionality. More...

#include <plugin_view.h>

Inheritance diagram for PluginView:

Public Member Functions

 PluginView (QWidget *parent=nullptr)
 Constructs a new PluginView object.
QPointF getCenter () const
 Gets the current center point of the view.
qreal getScale () const
 Gets the current scale factor of the view.
void setScale (qreal scale)
 Sets the scale factor of the view.
void zoom (float scaleFactor)
 Zooms in by a specified scale factor.
void centerOn (const QPointF &pos)
 Centers the view on a given position.
void centerOn (const QGraphicsItem *item)
 Centers the view on a given QGraphicsItem.

Protected Member Functions

void keyPressEvent (QKeyEvent *) override
 Handles key press events.
void keyReleaseEvent (QKeyEvent *) override
 Handles key release events.
void mouseMoveEvent (QMouseEvent *) override
 Handles mouse move events.
void mousePressEvent (QMouseEvent *) override
 Handles mouse press events.
void mouseReleaseEvent (QMouseEvent *) override
 Handles mouse release events.
void wheelEvent (QWheelEvent *) override
 Handles wheel events.

Private Member Functions

void pan (QPointF delta)
 Determines which mouse button is used for panning.
void zoomIn ()
 Zooms in.
void zoomOut ()
 Zooms out.
void resetZoom ()
 Resets the view to its default scale.
qreal quantisedScale (qreal proposedScale) const
 Quantises a proposed scale factor to ensure it is within valid limits.
void setMaxSize ()
 Sets the maximum size of the view's scene rect.

Private Attributes

bool mDoMousePanning
 Flag to determine if mouse panning should be done.
bool mDoKeyZoom
 Determines whether mouse panning is enabled.
QPoint mLastMousePos
 Determines whether key-based zooming is enabled.
QPointF mCenterPoint
 Stores the last mouse position for panning.
qreal mPanSpeed
 Keeps track of the current center point of the view.
qreal mZoomDelta
 Controls the speed of the panning action.
Qt::Key mZoomKey
 Defines the increment or decrement in zoom level.
qreal mMinZoom
 Specifies the key that triggers zoom actions.
qreal mMaxZoom
 Sets the lower limit for the zoom factor.
Qt::MouseButton mPanButton
 Sets the upper limit for the zoom factor.

Detailed Description

Custom QGraphicsView for plugin functionality.

Constructor & Destructor Documentation

◆ PluginView()

PluginView::PluginView ( QWidget * parent = nullptr)

Constructs a new PluginView object.

Parameters
parentPointer to the parent widget.

Member Function Documentation

◆ centerOn() [1/2]

void PluginView::centerOn ( const QGraphicsItem * item)

Centers the view on a given QGraphicsItem.

Parameters
itemThe QGraphicsItem to center on.

◆ centerOn() [2/2]

void PluginView::centerOn ( const QPointF & pos)

Centers the view on a given position.

Parameters
posThe position to center on.

◆ getCenter()

QPointF PluginView::getCenter ( ) const

Gets the current center point of the view.

Returns
QPointF The current center point.

◆ getScale()

qreal PluginView::getScale ( ) const

Gets the current scale factor of the view.

Returns
qreal The current scale factor.

◆ keyPressEvent()

void PluginView::keyPressEvent ( QKeyEvent * event)
overrideprotected

Handles key press events.

Parameters
eventPointer to the QKeyEvent object.

◆ keyReleaseEvent()

void PluginView::keyReleaseEvent ( QKeyEvent * event)
overrideprotected

Handles key release events.

Parameters
eventPointer to the QKeyEvent object.

◆ mouseMoveEvent()

void PluginView::mouseMoveEvent ( QMouseEvent * event)
overrideprotected

Handles mouse move events.

Parameters
eventPointer to the QMouseEvent object.

◆ mousePressEvent()

void PluginView::mousePressEvent ( QMouseEvent * event)
overrideprotected

Handles mouse press events.

Parameters
eventPointer to the QMouseEvent object.

◆ mouseReleaseEvent()

void PluginView::mouseReleaseEvent ( QMouseEvent * event)
overrideprotected

Handles mouse release events.

Parameters
eventPointer to the QMouseEvent object.

◆ pan()

void PluginView::pan ( QPointF delta)
private

Determines which mouse button is used for panning.

Pans the view by a given delta.

Parameters
deltaThe delta to pan by.

◆ quantisedScale()

qreal PluginView::quantisedScale ( qreal proposedScale) const
private

Quantises a proposed scale factor to ensure it is within valid limits.

Parameters
proposedScaleThe proposed scale factor.
Returns
qreal The quantised scale factor.

◆ setScale()

void PluginView::setScale ( qreal scale)

Sets the scale factor of the view.

Parameters
scaleThe new scale factor.

◆ wheelEvent()

void PluginView::wheelEvent ( QWheelEvent * event)
overrideprotected

Handles wheel events.

Parameters
eventPointer to the QWheelEvent object.

◆ zoom()

void PluginView::zoom ( float scaleFactor)

Zooms in by a specified scale factor.

Parameters
scaleFactorThe zoom scale factor.

Member Data Documentation

◆ mCenterPoint

QPointF PluginView::mCenterPoint
private

Stores the last mouse position for panning.

Current center point of the view.

◆ mDoKeyZoom

bool PluginView::mDoKeyZoom
private

Determines whether mouse panning is enabled.

Flag to determine if key zooming should be done.

◆ mLastMousePos

QPoint PluginView::mLastMousePos
private

Determines whether key-based zooming is enabled.

Last known mouse position during panning.

◆ mMaxZoom

qreal PluginView::mMaxZoom
private

Sets the lower limit for the zoom factor.

Maximum allowed zoom level.

◆ mMinZoom

qreal PluginView::mMinZoom
private

Specifies the key that triggers zoom actions.

Minimum allowed zoom level.

◆ mPanButton

Qt::MouseButton PluginView::mPanButton
private

Sets the upper limit for the zoom factor.

Mouse button used for panning.

◆ mPanSpeed

qreal PluginView::mPanSpeed
private

Keeps track of the current center point of the view.

Speed at which the view pans.

◆ mZoomDelta

qreal PluginView::mZoomDelta
private

Controls the speed of the panning action.

Delta value for zooming.

◆ mZoomKey

Qt::Key PluginView::mZoomKey
private

Defines the increment or decrement in zoom level.

Key used for zooming.


The documentation for this class was generated from the following files:
  • /__w/maki/maki/app/system/plugin_view.h
  • /__w/maki/maki/app/system/plugin_view.cpp