/** * Manage the scene, which contains a single Graph, and respond to user input. This serves as * the controller for the MVC (Graph, TikzView, TikzScene). */ #ifndef TIKZSCENE_H #define TIKZSCENE_H #include "graph.h" #include "nodeitem.h" #include "edgeitem.h" #include #include #include #include #include #include #include class TikzScene : public QGraphicsScene { Q_OBJECT public: TikzScene(Graph *graph, QObject *parent); ~TikzScene(); Graph *graph() const; void setGraph(Graph *graph); QVector nodeItems() const; QVector edgeItems() const; public slots: void graphReplaced(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); private: Graph *_graph; QVector _nodeItems; QVector _edgeItems; QMap _oldNodePositions; }; #endif // TIKZSCENE_H