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