-
Notifications
You must be signed in to change notification settings - Fork 4
/
view.h
114 lines (92 loc) · 2.14 KB
/
view.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef VIEW_H
#define VIEW_H
#include <QFrame>
#include <QGraphicsView>
#include "model.h"
#include "square.h"
#include "mainwindow.h"
#include <QListWidget>
#include <QMouseEvent>
QT_BEGIN_NAMESPACE
class QLabel;
class QSlider;
class QToolButton;
class QListWidget;
QT_END_NAMESPACE
class View;
class model;
class GraphicsView : public QGraphicsView
{
Q_OBJECT
public:
GraphicsView(View *v) : QGraphicsView(), view(v) { }
protected:
#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
//void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
//void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
#endif
private:
View *view;
};
class View : public QFrame
{
Q_OBJECT
public:
explicit View(const QString &name, model *Mod, QWidget *parent = 0);
QGraphicsView *view() const;
model *Model;
void keyPressEvent(QKeyEvent *event);
public Q_SLOTS:
void zoomIn(int level = 1);
void itemSel(QListWidgetItem *item);
void save();
void zoomOut(int level = 1);
void open();
private Q_SLOTS:
void print();
void resetView();
void setResetButtonEnabled();
void setupMatrix();
void dragMode();
void selectMode();
void rotateLeft();
void rotateRight();
void myClose();
void edit();
void openFile();
void addConnector();
void deleteMode();
void addLabel();
private:
QLineEdit *in;
GraphicsView *graphicsView;
QMenuBar *menu_bar;
QMenu *menu;
QMenu *menu2;
QMenu *menu3;
QMenu *menu4;
QAction *exitAction;
QAction *newAction;
QAction *printAction;
QAction *helpAction;
QAction *saveAction;
QAction *openAction;
QLabel *label;
QLabel *label2;
QLabel *colorLabel;
QComboBox *combo;
QToolButton *saveButton;
QToolButton *selectModeButton;
QToolButton *dragModeButton;
QToolButton *deleteButton;
QToolButton *antialiasButton;
QToolButton *resetButton;
QToolButton *addConnectorButton;
QToolButton *zoomInButton;
QToolButton *zoomOutButton;
QSlider *zoomSlider;
QSlider *rotateSlider;
QListWidget *shapesList;
};
#endif // VIEW_H