LibrePCB Developers Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
 
void showWaitingSpinner () noexcept
 
void hideWaitingSpinner () noexcept
 

Signals

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

Public Member Functions

 GraphicsView (const GraphicsView &other)=delete
 
 GraphicsView (QWidget *parent=nullptr, IF_GraphicsViewEventHandler *eventHandler=nullptr) noexcept
 
 ~GraphicsView () noexcept
 
GraphicsScenegetScene () const noexcept
 
QRectF getVisibleSceneRect () const noexcept
 
bool getUseOpenGl () const noexcept
 
bool isMouseButtonPressed (Qt::MouseButtons btn) const noexcept
 
qint64 getIdleTimeMs () const noexcept
 
void setSpinnerColor (const QColor &color) noexcept
 
void setInfoBoxColors (const QColor &fill, const QColor &text) noexcept
 
void setUseOpenGl (bool useOpenGl) noexcept
 
void setScene (GraphicsScene *scene) noexcept
 
void setVisibleSceneRect (const QRectF &rect) noexcept
 
void setInfoBoxText (const QString &text) noexcept
 
void setEventHandlerObject (IF_GraphicsViewEventHandler *eventHandler) noexcept
 
Point mapGlobalPosToScenePos (const QPoint &globalPosPx) const noexcept
 
QPainterPath calcPosWithTolerance (const Point &pos, qreal multiplier=1) const noexcept
 
void handleMouseWheelEvent (QGraphicsSceneWheelEvent *event) noexcept
 
GraphicsViewoperator= (const GraphicsView &rhs)=delete
 

Private Slots

void zoomAnimationValueChanged (const QVariant &value) noexcept
 

Private Member Functions

void wheelEvent (QWheelEvent *event)
 
bool eventFilter (QObject *obj, QEvent *event)
 

Private Attributes

QScopedPointer< WaitingSpinnerWidgetmWaitingSpinnerWidget
 
QScopedPointer< QLabel > mInfoBoxLabel
 
IF_GraphicsViewEventHandlermEventHandlerObject
 
GraphicsScenemScene
 
QVariantAnimation * mZoomAnimation
 
bool mUseOpenGl
 
volatile bool mPanningActive
 
Qt::MouseButton mPanningButton
 
Qt::MouseButtons mPressedMouseButtons
 
QCursor mCursorBeforePanning
 
qint64 mIdleTimeMs
 

Static Private Attributes

static constexpr qreal sZoomStepFactor = 1.3
 

Detailed Description

The GraphicsView class.

Constructor & Destructor Documentation

◆ GraphicsView() [1/2]

GraphicsView ( const GraphicsView other)
delete

◆ GraphicsView() [2/2]

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

◆ ~GraphicsView()

~GraphicsView ( )
noexcept

Member Function Documentation

◆ getScene()

GraphicsScene * getScene ( ) const
inlinenoexcept

◆ getVisibleSceneRect()

QRectF getVisibleSceneRect ( ) const
noexcept

◆ getUseOpenGl()

bool getUseOpenGl ( ) const
inlinenoexcept

◆ isMouseButtonPressed()

bool isMouseButtonPressed ( Qt::MouseButtons  btn) const
inlinenoexcept

◆ getIdleTimeMs()

qint64 getIdleTimeMs ( ) const
inlinenoexcept

◆ setSpinnerColor()

void setSpinnerColor ( const QColor &  color)
noexcept

◆ setInfoBoxColors()

void setInfoBoxColors ( const QColor &  fill,
const QColor &  text 
)
noexcept

◆ setUseOpenGl()

void setUseOpenGl ( bool  useOpenGl)
noexcept

◆ setScene()

void setScene ( GraphicsScene scene)
noexcept

◆ setVisibleSceneRect()

void setVisibleSceneRect ( const QRectF &  rect)
noexcept

◆ setInfoBoxText()

void setInfoBoxText ( const QString &  text)
noexcept
+ Here is the caller graph for this function:

◆ setEventHandlerObject()

void setEventHandlerObject ( IF_GraphicsViewEventHandler eventHandler)
noexcept

◆ mapGlobalPosToScenePos()

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

◆ calcPosWithTolerance()

QPainterPath calcPosWithTolerance ( const Point pos,
qreal  multiplier = 1 
) const
noexcept

◆ handleMouseWheelEvent()

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

◆ operator=()

GraphicsView & operator= ( const GraphicsView rhs)
delete

◆ zoomIn

void zoomIn ( )
slotnoexcept

◆ zoomOut

void zoomOut ( )
slotnoexcept

◆ zoomAll

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

◆ zoomToRect

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

◆ showWaitingSpinner

void showWaitingSpinner ( )
slotnoexcept

◆ hideWaitingSpinner

void hideWaitingSpinner ( )
slotnoexcept

◆ 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:

◆ wheelEvent()

void wheelEvent ( QWheelEvent *  event)
private

◆ eventFilter()

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

Member Data Documentation

◆ mWaitingSpinnerWidget

QScopedPointer<WaitingSpinnerWidget> mWaitingSpinnerWidget
private

◆ mInfoBoxLabel

QScopedPointer<QLabel> mInfoBoxLabel
private

◆ mEventHandlerObject

IF_GraphicsViewEventHandler* mEventHandlerObject
private

◆ mScene

GraphicsScene* mScene
private

◆ mZoomAnimation

QVariantAnimation* mZoomAnimation
private

◆ mUseOpenGl

bool mUseOpenGl
private

◆ mPanningActive

volatile bool mPanningActive
private

◆ mPanningButton

Qt::MouseButton mPanningButton
private

◆ mPressedMouseButtons

Qt::MouseButtons mPressedMouseButtons
private

◆ mCursorBeforePanning

QCursor mCursorBeforePanning
private

◆ mIdleTimeMs

qint64 mIdleTimeMs
private

◆ sZoomStepFactor

constexpr qreal sZoomStepFactor = 1.3
staticconstexprprivate

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