50 #ifndef VSI_GRAPHICSSCENE_HH
51 #define VSI_GRAPHICSSCENE_HH
55 #include <QGraphicsScene>
57 #include <QDomDocument>
58 #include <QDomElement>
62 class QGraphicsRectItem;
76 class ElementFunction;
105 void moveElements (qreal _dx, qreal _dy,
bool _selected =
false);
132 const QList<SceneElement *>&
elements ()
const;
135 QString
generateCode (QString &errors,
bool _codeOnly =
false);
141 void saveToXml (QDomDocument &_doc, QDomElement &_root);
166 virtual void drawBackground(QPainter *_painter,
const QRectF &_rect);
169 void dragEnterEvent (QGraphicsSceneDragDropEvent *_event);
170 void dragLeaveEvent (QGraphicsSceneDragDropEvent *_event);
171 void dragMoveEvent (QGraphicsSceneDragDropEvent *_event);
172 void dropEvent (QGraphicsSceneDragDropEvent *_event);
175 void mousePressEvent (QGraphicsSceneMouseEvent *_event);
176 void mouseMoveEvent (QGraphicsSceneMouseEvent *_event);
177 void mouseReleaseEvent (QGraphicsSceneMouseEvent *_event);
181 void updateConnections ();
184 void sceneResized (
const QRectF &_rect);
189 QString updateConnections (
SceneElement *_from,
bool _isStart);
192 bool validMimeData (
const QMimeData *);
195 QString mimeDataElementName (
const QMimeData *);
198 QPoint mimeDataPoint (
const QMimeData *);
201 void loadElement (QXmlQuery &_xml);
204 void loadConnection (QXmlQuery &_xml);
207 QList<SceneElement *> getAllElements ();
220 QGraphicsRectItem *selection_;
221 QPointF selectionStart_;
222 bool selectionActive_;
bool removeElement(SceneElement *_element)
Remove the element from the scene.
QRectF elementsBoundingRect()
Bounding rectangle of all scene elements.
void contentChanged()
Informs about content changes.
const QList< SceneElement * > & elements() const
Scene elements.
void loadFromXml(QXmlQuery &_xml)
Load from xml.
void clearScene(bool _start=false)
clear the whole scene (_start = keep start element)
void scaleElements(qreal _delta)
Scale all elements with scaling center in the center of the scene.
~GraphicsScene()
Destructor.
GraphicsScene(VSI::Context *_ctx, ElementFunction *_function=NULL)
Constructor.
void saveToXml(QDomDocument &_doc, QDomElement &_root)
Save to xml.
void moveElements(qreal _dx, qreal _dy, bool _selected=false)
Moves all elements.
void contentChange()
handle content changes
void addElement(SceneElement *_element)
Add the element to the scene.
qreal getNewZ()
Returns a new Z value that is above all elements.
void setActiveConnection(Connection *_conn)
Sets the active connection.
QString generateCode(QString &errors, bool _codeOnly=false)
Generate textual script code (_codeOnly = only pure code block)
WayFind * wayFind()
WayFind object.
GraphicsView * graphicsView()
Graphics view of the scene.
void mouseMove(QPointF _pos)
Redirect mouse movement to tools area.
ElementArea * elementArea() const
Element area.
void mouseRelease(QPointF _pos, QGraphicsItem *_item)
Redirect mouse release to tools area.