OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::GraphicsScene Class Reference

Graphics Scene for ot::GraphicsItem Adding QGraphicsItems to the scene that do not inherit ot::GraphicsItem might lead to undefined behavior. More...

#include "GraphicsScene.h"

Inheritance diagram for ot::GraphicsScene:
GraphicsItemDesignerScene

Public Slots

void slotSelectionChanged (void)
 

Signals

void selectionChangeFinished (void)
 
void graphicsItemDoubleClicked (const ot::GraphicsItem *_item)
 

Public Member Functions

 GraphicsScene (GraphicsView *_view)
 
 GraphicsScene (const QRectF &_sceneRect, GraphicsView *_view)
 
virtual ~GraphicsScene ()
 
void startConnection (ot::GraphicsItem *_item)
 A connection line according to the current configuration will be drawn with the provided item as origin.
 
void startConnectionToConnection (ot::GraphicsConnectionItem *_targetedConnection, const Point2DD &_pos)
 Will request a connection from the currently set origin to the provided target connection. The new control point is pos and should be the mouse press position.
 
void stopConnection (void)
 
void setGrid (const Grid &_grid)
 
const GridgetGrid (void) const
 
void setGridStep (int _step)
 
void setGridStep (const Point2D &_step)
 
Point2D getGridStep (void) const
 
void setWideGridLineCounter (int _counter)
 
void setWideGridLineCounter (const Point2D &_counter)
 
Point2D getWideGridLineCounter (void) const
 
void setGridFlag (Grid::GridFlag _flag, bool _active=true)
 
void setGridFlags (const Grid::GridFlags &_flags)
 
const Grid::GridFlagsgetGridFlags (void) const
 
void setGridSnapMode (Grid::GridSnapMode _mode)
 
Grid::GridSnapMode getGridSnapMode (void) const
 
void setGridLineStyle (const OutlineF &_outline)
 
const OutlineFgetGridLineStyle (void) const
 
void setMultiselectionEnabled (bool _enabled)
 
bool getMultiselectionEnabled (void) const
 
void checkMaxTriggerDistance (double _triggerDistance)
 
void checkMaxTriggerDistance (const MarginsD &_triggerDistance)
 
GraphicsViewgetGraphicsView (void)
 
const GraphicsViewgetGraphicsView (void) const
 
void setConnectionPreviewShape (GraphicsConnectionCfg::ConnectionShape _shape)
 
GraphicsConnectionCfg::ConnectionShape getConnectionPreviewShape (void) const
 
void setIgnoreEvents (bool _ignore)
 
bool getIgnoreEvents (void) const
 
QPointF snapToGrid (const QPointF &_pt) const
 
QPointF snapToGrid (const GraphicsItem *_item) const
 Snaps the item to the grid according to the item flags and returns the top left pos.
 
void deselectAll (void)
 
void moveAllSelectedItems (const Point2DD &_delta)
 
void rotateAllSelectedItems (double _relativeAngle)
 
void flipAllSelectedItems (Qt::Orientation _flipAxis)
 
void itemAboutToBeRemoved (GraphicsItem *_item)
 
void connectionAboutToBeRemoved (GraphicsConnectionItem *_connection)
 
void elementAboutToBeRemoved (GraphicsElement *_element)
 
void handleSelectionChanged (void)
 

Protected Member Functions

virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *_event) override
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *_event) override
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *_event) override
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *_event) override
 
virtual void drawBackground (QPainter *_painter, const QRectF &_rect) override
 
void drawGrid (QPainter *_painter, const QRectF &_rect)
 
qreal calculateScaledGridLineWidth (QPainter *_painter, qreal _normalWidth) const
 
void calculateGridLines (const QRectF &_painterRect, QList< QLineF > &_normalLines, QList< QLineF > &_wideLines, QList< QLineF > &_centerLines) const
 
Point2D calculateScaledGridStepSize (const QRectF &_rect) const
 
GraphicsElementfindClosestConnectableElement (const QPointF &_pos) const
 
QList< QGraphicsItem * > findItemsInTriggerDistance (const QPointF &_pos) const
 

Detailed Description

Graphics Scene for ot::GraphicsItem Adding QGraphicsItems to the scene that do not inherit ot::GraphicsItem might lead to undefined behavior.

Constructor & Destructor Documentation

◆ GraphicsScene() [1/2]

ot::GraphicsScene::GraphicsScene ( GraphicsView * _view)

◆ GraphicsScene() [2/2]

ot::GraphicsScene::GraphicsScene ( const QRectF & _sceneRect,
GraphicsView * _view )

◆ ~GraphicsScene()

ot::GraphicsScene::~GraphicsScene ( )
virtual

Member Function Documentation

◆ calculateGridLines()

void ot::GraphicsScene::calculateGridLines ( const QRectF & _painterRect,
QList< QLineF > & _normalLines,
QList< QLineF > & _wideLines,
QList< QLineF > & _centerLines ) const
protected

◆ calculateScaledGridLineWidth()

qreal ot::GraphicsScene::calculateScaledGridLineWidth ( QPainter * _painter,
qreal _normalWidth ) const
protected

◆ calculateScaledGridStepSize()

ot::Point2D ot::GraphicsScene::calculateScaledGridStepSize ( const QRectF & _rect) const
protected

◆ checkMaxTriggerDistance() [1/2]

void ot::GraphicsScene::checkMaxTriggerDistance ( const MarginsD & _triggerDistance)

◆ checkMaxTriggerDistance() [2/2]

void ot::GraphicsScene::checkMaxTriggerDistance ( double _triggerDistance)

◆ connectionAboutToBeRemoved()

void ot::GraphicsScene::connectionAboutToBeRemoved ( GraphicsConnectionItem * _connection)

◆ deselectAll()

void ot::GraphicsScene::deselectAll ( void )

◆ drawBackground()

void ot::GraphicsScene::drawBackground ( QPainter * _painter,
const QRectF & _rect )
overrideprotectedvirtual

Reimplemented in GraphicsItemDesignerScene.

◆ drawGrid()

void ot::GraphicsScene::drawGrid ( QPainter * _painter,
const QRectF & _rect )
protected

◆ elementAboutToBeRemoved()

void ot::GraphicsScene::elementAboutToBeRemoved ( GraphicsElement * _element)

◆ findClosestConnectableElement()

ot::GraphicsElement * ot::GraphicsScene::findClosestConnectableElement ( const QPointF & _pos) const
protected

◆ findItemsInTriggerDistance()

QList< QGraphicsItem * > ot::GraphicsScene::findItemsInTriggerDistance ( const QPointF & _pos) const
protected

◆ flipAllSelectedItems()

void ot::GraphicsScene::flipAllSelectedItems ( Qt::Orientation _flipAxis)

◆ getConnectionPreviewShape()

GraphicsConnectionCfg::ConnectionShape ot::GraphicsScene::getConnectionPreviewShape ( void ) const
inline

◆ getGraphicsView() [1/2]

GraphicsView * ot::GraphicsScene::getGraphicsView ( void )
inline

◆ getGraphicsView() [2/2]

const GraphicsView * ot::GraphicsScene::getGraphicsView ( void ) const
inline

◆ getGrid()

const Grid & ot::GraphicsScene::getGrid ( void ) const
inline

◆ getGridFlags()

const Grid::GridFlags & ot::GraphicsScene::getGridFlags ( void ) const
inline

◆ getGridLineStyle()

const OutlineF & ot::GraphicsScene::getGridLineStyle ( void ) const
inline

◆ getGridSnapMode()

Grid::GridSnapMode ot::GraphicsScene::getGridSnapMode ( void ) const
inline

◆ getGridStep()

Point2D ot::GraphicsScene::getGridStep ( void ) const
inline

◆ getIgnoreEvents()

bool ot::GraphicsScene::getIgnoreEvents ( void ) const
inline

◆ getMultiselectionEnabled()

bool ot::GraphicsScene::getMultiselectionEnabled ( void ) const
inline

◆ getWideGridLineCounter()

Point2D ot::GraphicsScene::getWideGridLineCounter ( void ) const
inline

◆ graphicsItemDoubleClicked

void ot::GraphicsScene::graphicsItemDoubleClicked ( const ot::GraphicsItem * _item)
signal

◆ handleSelectionChanged()

void ot::GraphicsScene::handleSelectionChanged ( void )

◆ itemAboutToBeRemoved()

void ot::GraphicsScene::itemAboutToBeRemoved ( GraphicsItem * _item)

◆ mouseDoubleClickEvent()

void ot::GraphicsScene::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * _event)
overrideprotectedvirtual

◆ mouseMoveEvent()

void ot::GraphicsScene::mouseMoveEvent ( QGraphicsSceneMouseEvent * _event)
overrideprotectedvirtual

Reimplemented in GraphicsItemDesignerScene.

◆ mousePressEvent()

void ot::GraphicsScene::mousePressEvent ( QGraphicsSceneMouseEvent * _event)
overrideprotectedvirtual

Reimplemented in GraphicsItemDesignerScene.

◆ mouseReleaseEvent()

void ot::GraphicsScene::mouseReleaseEvent ( QGraphicsSceneMouseEvent * _event)
overrideprotectedvirtual

Reimplemented in GraphicsItemDesignerScene.

◆ moveAllSelectedItems()

void ot::GraphicsScene::moveAllSelectedItems ( const Point2DD & _delta)

◆ rotateAllSelectedItems()

void ot::GraphicsScene::rotateAllSelectedItems ( double _relativeAngle)

◆ selectionChangeFinished

void ot::GraphicsScene::selectionChangeFinished ( void )
signal

◆ setConnectionPreviewShape()

void ot::GraphicsScene::setConnectionPreviewShape ( GraphicsConnectionCfg::ConnectionShape _shape)
inline

◆ setGrid()

void ot::GraphicsScene::setGrid ( const Grid & _grid)
inline

◆ setGridFlag()

void ot::GraphicsScene::setGridFlag ( Grid::GridFlag _flag,
bool _active = true )
inline

◆ setGridFlags()

void ot::GraphicsScene::setGridFlags ( const Grid::GridFlags & _flags)
inline

◆ setGridLineStyle()

void ot::GraphicsScene::setGridLineStyle ( const OutlineF & _outline)
inline

◆ setGridSnapMode()

void ot::GraphicsScene::setGridSnapMode ( Grid::GridSnapMode _mode)
inline

◆ setGridStep() [1/2]

void ot::GraphicsScene::setGridStep ( const Point2D & _step)
inline

◆ setGridStep() [2/2]

void ot::GraphicsScene::setGridStep ( int _step)
inline

◆ setIgnoreEvents()

void ot::GraphicsScene::setIgnoreEvents ( bool _ignore)
inline

◆ setMultiselectionEnabled()

void ot::GraphicsScene::setMultiselectionEnabled ( bool _enabled)
inline

◆ setWideGridLineCounter() [1/2]

void ot::GraphicsScene::setWideGridLineCounter ( const Point2D & _counter)
inline

◆ setWideGridLineCounter() [2/2]

void ot::GraphicsScene::setWideGridLineCounter ( int _counter)
inline

◆ slotSelectionChanged

void ot::GraphicsScene::slotSelectionChanged ( void )
slot

◆ snapToGrid() [1/2]

QPointF ot::GraphicsScene::snapToGrid ( const GraphicsItem * _item) const

Snaps the item to the grid according to the item flags and returns the top left pos.

◆ snapToGrid() [2/2]

QPointF ot::GraphicsScene::snapToGrid ( const QPointF & _pt) const

◆ startConnection()

void ot::GraphicsScene::startConnection ( ot::GraphicsItem * _item)

A connection line according to the current configuration will be drawn with the provided item as origin.

Parameters
_itemOrigin item

◆ startConnectionToConnection()

void ot::GraphicsScene::startConnectionToConnection ( ot::GraphicsConnectionItem * _targetedConnection,
const Point2DD & _pos )

Will request a connection from the currently set origin to the provided target connection. The new control point is pos and should be the mouse press position.

Parameters
_targetConnectionThe destination for the connection request.
_posThe new control point position.

◆ stopConnection()

void ot::GraphicsScene::stopConnection ( void )

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