Developer Documentation
VSI::GraphicsScene Class Reference

#include <Plugin-VSI/scene/graphicsScene.hh>

Inheritance diagram for VSI::GraphicsScene:

Public Slots

void contentChange ()
 handle content changes More...
 
void clearScene (bool _start=false)
 clear the whole scene (_start = keep start element) More...
 

Signals

void contentChanged ()
 Informs about content changes.
 

Public Member Functions

 GraphicsScene (VSI::Context *_ctx, ElementFunction *_function=NULL)
 Constructor. More...
 
 ~GraphicsScene ()
 Destructor. More...
 
GraphicsViewgraphicsView ()
 Graphics view of the scene. More...
 
qreal getNewZ ()
 Returns a new Z value that is above all elements. More...
 
void moveElements (qreal _dx, qreal _dy, bool _selected=false)
 Moves all elements. More...
 
void scaleElements (qreal _delta)
 Scale all elements with scaling center in the center of the scene. More...
 
void scaleElements (qreal _delta, QPointF _center)
 Scale all elements with scaling center _canter. More...
 
void addElement (SceneElement *_element)
 Add the element to the scene. More...
 
bool removeElement (SceneElement *_element)
 Remove the element from the scene. More...
 
void mouseMove (QPointF _pos)
 Redirect mouse movement to tools area. More...
 
void mouseRelease (QPointF _pos, QGraphicsItem *_item)
 Redirect mouse release to tools area. More...
 
QRectF elementsBoundingRect ()
 Bounding rectangle of all scene elements. More...
 
ElementAreaelementArea () const
 Element area. More...
 
const QList< SceneElement * > & elements () const
 Scene elements. More...
 
QString generateCode (QString &errors, bool _codeOnly=false)
 Generate textual script code (_codeOnly = only pure code block) More...
 
WayFindwayFind ()
 WayFind object. More...
 
void saveToXml (QDomDocument &_doc, QDomElement &_root)
 Save to xml. More...
 
void loadFromXml (QDomElement &_domElement)
 Load from xml. More...
 
ElementFunctionfunction ()
 Associated function. More...
 
void setActiveConnection (Connection *_conn)
 Sets the active connection. More...
 

Protected Member Functions

virtual void drawBackground (QPainter *_painter, const QRectF &_rect)
 
void dragEnterEvent (QGraphicsSceneDragDropEvent *_event)
 
void dragLeaveEvent (QGraphicsSceneDragDropEvent *_event)
 
void dragMoveEvent (QGraphicsSceneDragDropEvent *_event)
 
void dropEvent (QGraphicsSceneDragDropEvent *_event)
 
void mousePressEvent (QGraphicsSceneMouseEvent *_event)
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *_event)
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *_event)
 

Private Slots

void updateConnections ()
 
void sceneResized (const QRectF &_rect)
 

Private Member Functions

QString updateConnections (SceneElement *_from, bool _isStart)
 
bool validMimeData (const QMimeData *)
 
QString mimeDataElementName (const QMimeData *)
 
QPoint mimeDataPoint (const QMimeData *)
 
void loadElement (QDomElement &_domElement, std::vector< QString > &_connections)
 
void loadConnection (QString &_connections)
 
QList< SceneElement * > getAllElements ()
 

Private Attributes

Contextctx_
 
ElementFunctionfunction_
 
GraphicsViewview_
 
SceneElementdndElement_
 
SceneToolstools_
 
ElementAreaelementArea_
 
QGraphicsRectItem * selection_
 
QPointF selectionStart_
 
bool selectionActive_
 
bool dontMoveStart_
 
bool blockChanges_
 
ConnectionactiveConnection_
 
qreal currentZ_
 
WayFindwayFind_
 

Detailed Description

Implementation of the Qt graphics scene graph and the represatation of the visual script

Definition at line 79 of file graphicsScene.hh.

Constructor & Destructor Documentation

◆ GraphicsScene()

VSI::GraphicsScene::GraphicsScene ( VSI::Context _ctx,
ElementFunction _function = NULL 
)

Constructor.

Definition at line 84 of file graphicsScene.cc.

◆ ~GraphicsScene()

VSI::GraphicsScene::~GraphicsScene ( )

Destructor.

destructor

Definition at line 153 of file graphicsScene.cc.

Member Function Documentation

◆ addElement()

void VSI::GraphicsScene::addElement ( SceneElement _element)

Add the element to the scene.

Definition at line 297 of file graphicsScene.cc.

◆ clearScene

void VSI::GraphicsScene::clearScene ( bool  _start = false)
slot

clear the whole scene (_start = keep start element)

Definition at line 1025 of file graphicsScene.cc.

◆ contentChange

void VSI::GraphicsScene::contentChange ( )
slot

handle content changes

Definition at line 1098 of file graphicsScene.cc.

◆ dragEnterEvent()

void VSI::GraphicsScene::dragEnterEvent ( QGraphicsSceneDragDropEvent *  _event)
protected

Definition at line 173 of file graphicsScene.cc.

◆ dragLeaveEvent()

void VSI::GraphicsScene::dragLeaveEvent ( QGraphicsSceneDragDropEvent *  _event)
protected

Definition at line 197 of file graphicsScene.cc.

◆ dragMoveEvent()

void VSI::GraphicsScene::dragMoveEvent ( QGraphicsSceneDragDropEvent *  _event)
protected

Definition at line 214 of file graphicsScene.cc.

◆ drawBackground()

void VSI::GraphicsScene::drawBackground ( QPainter *  _painter,
const QRectF &  _rect 
)
protectedvirtual

Definition at line 165 of file graphicsScene.cc.

◆ dropEvent()

void VSI::GraphicsScene::dropEvent ( QGraphicsSceneDragDropEvent *  _event)
protected

Definition at line 233 of file graphicsScene.cc.

◆ elementArea()

ElementArea * VSI::GraphicsScene::elementArea ( ) const
inline

Element area.

Definition at line 122 of file graphicsScene.hh.

◆ elements()

const QList< SceneElement * > & VSI::GraphicsScene::elements ( ) const

Scene elements.

Bounding rectangle of all scene elements.

Definition at line 346 of file graphicsScene.cc.

◆ elementsBoundingRect()

QRectF VSI::GraphicsScene::elementsBoundingRect ( )

Bounding rectangle of all scene elements.

Definition at line 335 of file graphicsScene.cc.

◆ function()

ElementFunction * VSI::GraphicsScene::function ( )
inline

Associated function.

Definition at line 140 of file graphicsScene.hh.

◆ generateCode()

QString VSI::GraphicsScene::generateCode ( QString &  errors,
bool  _codeOnly = false 
)

Generate textual script code (_codeOnly = only pure code block)

Definition at line 456 of file graphicsScene.cc.

◆ getAllElements()

QList< SceneElement * > VSI::GraphicsScene::getAllElements ( )
private

Definition at line 437 of file graphicsScene.cc.

◆ getNewZ()

qreal VSI::GraphicsScene::getNewZ ( )

Returns a new Z value that is above all elements.

Definition at line 250 of file graphicsScene.cc.

◆ graphicsView()

GraphicsView * VSI::GraphicsScene::graphicsView ( )
inline

Graphics view of the scene.

Definition at line 92 of file graphicsScene.hh.

◆ loadConnection()

void VSI::GraphicsScene::loadConnection ( QString &  _connections)
private

Definition at line 953 of file graphicsScene.cc.

◆ loadElement()

void VSI::GraphicsScene::loadElement ( QDomElement &  _domElement,
std::vector< QString > &  _connections 
)
private

Definition at line 937 of file graphicsScene.cc.

◆ loadFromXml()

void VSI::GraphicsScene::loadFromXml ( QDomElement &  _domElement)

Load from xml.

Definition at line 872 of file graphicsScene.cc.

◆ mimeDataElementName()

QString VSI::GraphicsScene::mimeDataElementName ( const QMimeData *  _m)
private

Definition at line 802 of file graphicsScene.cc.

◆ mimeDataPoint()

QPoint VSI::GraphicsScene::mimeDataPoint ( const QMimeData *  _m)
private

Definition at line 817 of file graphicsScene.cc.

◆ mouseMove()

void VSI::GraphicsScene::mouseMove ( QPointF  _pos)

Redirect mouse movement to tools area.

Definition at line 320 of file graphicsScene.cc.

◆ mouseMoveEvent()

void VSI::GraphicsScene::mouseMoveEvent ( QGraphicsSceneMouseEvent *  _event)
protected

Definition at line 381 of file graphicsScene.cc.

◆ mousePressEvent()

void VSI::GraphicsScene::mousePressEvent ( QGraphicsSceneMouseEvent *  _event)
protected

Definition at line 354 of file graphicsScene.cc.

◆ mouseRelease()

void VSI::GraphicsScene::mouseRelease ( QPointF  _pos,
QGraphicsItem *  _item 
)

Redirect mouse release to tools area.

Definition at line 328 of file graphicsScene.cc.

◆ mouseReleaseEvent()

void VSI::GraphicsScene::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  _event)
protected

Definition at line 399 of file graphicsScene.cc.

◆ moveElements()

void VSI::GraphicsScene::moveElements ( qreal  _dx,
qreal  _dy,
bool  _selected = false 
)

Moves all elements.

Definition at line 259 of file graphicsScene.cc.

◆ removeElement()

bool VSI::GraphicsScene::removeElement ( SceneElement _element)

Remove the element from the scene.

Definition at line 307 of file graphicsScene.cc.

◆ saveToXml()

void VSI::GraphicsScene::saveToXml ( QDomDocument &  _doc,
QDomElement &  _root 
)

Save to xml.

Definition at line 840 of file graphicsScene.cc.

◆ scaleElements() [1/2]

void VSI::GraphicsScene::scaleElements ( qreal  _delta)

Scale all elements with scaling center in the center of the scene.

Definition at line 278 of file graphicsScene.cc.

◆ scaleElements() [2/2]

void VSI::GraphicsScene::scaleElements ( qreal  _delta,
QPointF  _center 
)

Scale all elements with scaling center _canter.

Definition at line 288 of file graphicsScene.cc.

◆ sceneResized

void VSI::GraphicsScene::sceneResized ( const QRectF &  _rect)
privateslot

Definition at line 1109 of file graphicsScene.cc.

◆ setActiveConnection()

void VSI::GraphicsScene::setActiveConnection ( Connection _conn)
inline

Sets the active connection.

Definition at line 143 of file graphicsScene.hh.

◆ updateConnections [1/2]

void VSI::GraphicsScene::updateConnections ( )
privateslot

Definition at line 1071 of file graphicsScene.cc.

◆ updateConnections() [2/2]

QString VSI::GraphicsScene::updateConnections ( SceneElement _from,
bool  _isStart 
)
private

Definition at line 750 of file graphicsScene.cc.

◆ validMimeData()

bool VSI::GraphicsScene::validMimeData ( const QMimeData *  _m)
private

Definition at line 794 of file graphicsScene.cc.

◆ wayFind()

WayFind * VSI::GraphicsScene::wayFind ( )
inline

WayFind object.

Definition at line 131 of file graphicsScene.hh.

Member Data Documentation

◆ activeConnection_

Connection* VSI::GraphicsScene::activeConnection_
private

Definition at line 220 of file graphicsScene.hh.

◆ blockChanges_

bool VSI::GraphicsScene::blockChanges_
private

Definition at line 218 of file graphicsScene.hh.

◆ ctx_

Context* VSI::GraphicsScene::ctx_
private

Definition at line 204 of file graphicsScene.hh.

◆ currentZ_

qreal VSI::GraphicsScene::currentZ_
private

Definition at line 222 of file graphicsScene.hh.

◆ dndElement_

SceneElement* VSI::GraphicsScene::dndElement_
private

Definition at line 208 of file graphicsScene.hh.

◆ dontMoveStart_

bool VSI::GraphicsScene::dontMoveStart_
private

Definition at line 217 of file graphicsScene.hh.

◆ elementArea_

ElementArea* VSI::GraphicsScene::elementArea_
private

Definition at line 211 of file graphicsScene.hh.

◆ function_

ElementFunction* VSI::GraphicsScene::function_
private

Definition at line 205 of file graphicsScene.hh.

◆ selection_

QGraphicsRectItem* VSI::GraphicsScene::selection_
private

Definition at line 213 of file graphicsScene.hh.

◆ selectionActive_

bool VSI::GraphicsScene::selectionActive_
private

Definition at line 215 of file graphicsScene.hh.

◆ selectionStart_

QPointF VSI::GraphicsScene::selectionStart_
private

Definition at line 214 of file graphicsScene.hh.

◆ tools_

SceneTools* VSI::GraphicsScene::tools_
private

Definition at line 209 of file graphicsScene.hh.

◆ view_

GraphicsView* VSI::GraphicsScene::view_
private

Definition at line 206 of file graphicsScene.hh.

◆ wayFind_

WayFind* VSI::GraphicsScene::wayFind_
private

Definition at line 224 of file graphicsScene.hh.


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