LibrePCB Developers Documentation
GraphicsView Class Referencefinal

The GraphicsView class. More...

#include <graphicsview.h>

Inherits QGraphicsView.

+ Collaboration diagram for GraphicsView:

Public Slots

void zoomIn () noexcept
 
void zoomOut () noexcept
 
void zoomAll () noexcept
 
void zoomToRect (const QRectF &rect) noexcept
 

Signals

void cursorScenePositionChanged (const Point &pos)
 Cursor scene position changed signal. More...
 

Public Member Functions

 GraphicsView (QWidget *parent=nullptr, IF_GraphicsViewEventHandler *eventHandler=nullptr) noexcept
 
 ~GraphicsView () noexcept
 
GraphicsScenegetScene () const noexcept
 
QRectF getVisibleSceneRect () const noexcept
 
bool getUseOpenGl () const noexcept
 
const GridPropertiesgetGridProperties () const noexcept
 
void setUseOpenGl (bool useOpenGl) noexcept
 
void setGridProperties (const GridProperties &properties) noexcept
 
void setScene (GraphicsScene *scene) noexcept
 
void setVisibleSceneRect (const QRectF &rect) noexcept
 
void setSceneRectMarker (const QRectF &rect) noexcept
 Setup the marker for a specific scene rect. More...
 
void setOriginCrossVisible (bool visible) noexcept
 
void setEventHandlerObject (IF_GraphicsViewEventHandler *eventHandler) noexcept
 
Point mapGlobalPosToScenePos (const QPoint &globalPosPx, bool boundToView, bool mapToGrid) const noexcept
 
void handleMouseWheelEvent (QGraphicsSceneWheelEvent *event) noexcept
 

Private Slots

void zoomAnimationValueChanged (const QVariant &value) noexcept
 

Private Member Functions

 GraphicsView (const GraphicsView &other)=delete
 
GraphicsViewoperator= (const GraphicsView &rhs)=delete
 
void wheelEvent (QWheelEvent *event)
 
bool eventFilter (QObject *obj, QEvent *event)
 
void drawBackground (QPainter *painter, const QRectF &rect)
 
void drawForeground (QPainter *painter, const QRectF &rect)
 

Private Attributes

IF_GraphicsViewEventHandlermEventHandlerObject
 
GraphicsScenemScene
 
QVariantAnimation * mZoomAnimation
 
GridPropertiesmGridProperties
 
QRectF mSceneRectMarker
 
bool mOriginCrossVisible
 
bool mUseOpenGl
 
volatile bool mPanningActive
 
QCursor mCursorBeforePanning
 

Static Private Attributes

static constexpr qreal sZoomStepFactor = 1.3
 

Detailed Description

The GraphicsView class.

Constructor & Destructor Documentation

◆ GraphicsView() [1/2]

GraphicsView ( QWidget *  parent = nullptr,
IF_GraphicsViewEventHandler eventHandler = nullptr 
)
explicitnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~GraphicsView()

~GraphicsView ( )
noexcept

◆ GraphicsView() [2/2]

GraphicsView ( const GraphicsView other)
privatedelete

Member Function Documentation

◆ getScene()

GraphicsScene* getScene ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ getVisibleSceneRect()

QRectF getVisibleSceneRect ( ) const
noexcept
+ Here is the caller graph for this function:

◆ getUseOpenGl()

bool getUseOpenGl ( ) const
inlinenoexcept

◆ getGridProperties()

const GridProperties& getGridProperties ( ) const
inlinenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUseOpenGl()

void setUseOpenGl ( bool  useOpenGl)
noexcept
+ Here is the caller graph for this function:

◆ setGridProperties()

void setGridProperties ( const GridProperties properties)
noexcept
+ Here is the caller graph for this function:

◆ setScene()

void setScene ( GraphicsScene scene)
noexcept
+ Here is the caller graph for this function:

◆ setVisibleSceneRect()

void setVisibleSceneRect ( const QRectF &  rect)
noexcept
+ Here is the caller graph for this function:

◆ setSceneRectMarker()

void setSceneRectMarker ( const QRectF &  rect)
noexcept

Setup the marker for a specific scene rect.

This is intended to mark a specific area in a scene, with a line starting from the top left of the view, so the user can easily locate the specified area, even if it is very small.

Parameters
rectThe rect to mark. Pass an empty rect to clear the marker.
+ Here is the caller graph for this function:

◆ setOriginCrossVisible()

void setOriginCrossVisible ( bool  visible)
noexcept
+ Here is the caller graph for this function:

◆ setEventHandlerObject()

void setEventHandlerObject ( IF_GraphicsViewEventHandler eventHandler)
noexcept
+ Here is the caller graph for this function:

◆ mapGlobalPosToScenePos()

Point mapGlobalPosToScenePos ( const QPoint &  globalPosPx,
bool  boundToView,
bool  mapToGrid 
) const
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMouseWheelEvent()

void handleMouseWheelEvent ( QGraphicsSceneWheelEvent *  event)
noexcept
+ Here is the caller graph for this function:

◆ zoomIn

void zoomIn ( )
slotnoexcept
+ Here is the caller graph for this function:

◆ zoomOut

void zoomOut ( )
slotnoexcept
+ Here is the caller graph for this function:

◆ zoomAll

void zoomAll ( )
slotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ zoomToRect

void zoomToRect ( const QRectF &  rect)
slotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cursorScenePositionChanged

void cursorScenePositionChanged ( const Point pos)
signal

Cursor scene position changed signal.

Parameters
posThe new cursor position (not mapped to grid!)
+ Here is the caller graph for this function:

◆ zoomAnimationValueChanged

void zoomAnimationValueChanged ( const QVariant &  value)
privateslotnoexcept
+ Here is the caller graph for this function:

◆ operator=()

GraphicsView& operator= ( const GraphicsView rhs)
privatedelete
+ Here is the caller graph for this function:

◆ wheelEvent()

void wheelEvent ( QWheelEvent *  event)
private
+ Here is the caller graph for this function:

◆ eventFilter()

bool eventFilter ( QObject *  obj,
QEvent *  event 
)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawBackground()

void drawBackground ( QPainter *  painter,
const QRectF &  rect 
)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawForeground()

void drawForeground ( QPainter *  painter,
const QRectF &  rect 
)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mEventHandlerObject

IF_GraphicsViewEventHandler* mEventHandlerObject
private

◆ mScene

GraphicsScene* mScene
private

◆ mZoomAnimation

QVariantAnimation* mZoomAnimation
private

◆ mGridProperties

GridProperties* mGridProperties
private

◆ mSceneRectMarker

QRectF mSceneRectMarker
private

◆ mOriginCrossVisible

bool mOriginCrossVisible
private

◆ mUseOpenGl

bool mUseOpenGl
private

◆ mPanningActive

volatile bool mPanningActive
private

◆ mCursorBeforePanning

QCursor mCursorBeforePanning
private

◆ sZoomStepFactor

constexpr qreal sZoomStepFactor = 1.3
staticprivate

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