-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphicsscene.h
67 lines (60 loc) · 1.57 KB
/
graphicsscene.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// SPDX-License-Identifier: BSD-3-Clause
#ifndef GRAPHICSSCENE_H
#define GRAPHICSSCENE_H
#include <QBrush>
#include <vector>
#ifndef NDEBUG
#include <QDebug>
#endif
#include <QDir>
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>
#include <QGraphicsEllipseItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsTextItem>
#include <QInputDialog>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QKeyEvent>
#include <QLineEdit>
#include <QLineF>
#include <QMessageBox>
#include <QMouseEvent>
#include <QPdfWriter>
#include <QPen>
#include <QPointF>
#include <QTextStream>
#include "edge.h"
#include "inputdialog.h"
#include "node.h"
#ifndef SAVEFILEDESC
#define SAVEFILEDESC "rico-cluster-qt cluster (*.json)"
#endif
#ifndef EXPORTDOTFILEDESC
#define EXPORTDOTFILEDESC "graphviz dot digraph (*.dot)"
#endif
class GraphicsScene : public QGraphicsScene {
Q_OBJECT
public:
explicit GraphicsScene(QObject *parent = 0);
~GraphicsScene();
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
virtual void keyPressEvent(QKeyEvent *keyEvent);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
void save();
void saveAs();
void load();
void print();
void writeJsonFromScene(QJsonObject &json);
void exportToDot();
private:
std::vector<Edge *> edges;
std::vector<Node *> nodes;
QString saveFileName;
};
#endif // GRAPHICSSCENE_H