-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
executable file
·145 lines (120 loc) · 3.19 KB
/
mainwindow.cpp
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "paintwidget.h"
#include "oglwidget.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
PaintWidget *paintWidget = new PaintWidget(this);
connect(this, SIGNAL(changeCurrentShape(Shape::Code)),paintWidget, SLOT(setCurrentShape(Shape::Code)));
connect(this, SIGNAL(sendClearSignal()), paintWidget, SLOT(clearShapes()));
connect(this, SIGNAL(fill()), paintWidget, SLOT(fillPolygon()));
connect(this, SIGNAL(left()), paintWidget, SLOT(moveLeft()));
connect(this, SIGNAL(right()), paintWidget, SLOT(moveRight()));
connect(this, SIGNAL(up()), paintWidget, SLOT(moveUp()));
connect(this, SIGNAL(down()), paintWidget, SLOT(moveDown()));
connect(this, SIGNAL(rotateR()), paintWidget, SLOT(rotateClockwise()));
connect(this, SIGNAL(rotateL()), paintWidget, SLOT(rotateCounterClockwise()));
connect(this, SIGNAL(zoomin()), paintWidget, SLOT(ZoomIn()));
connect(this, SIGNAL(zoomout()),paintWidget, SLOT(ZoomOut()));
connect(this, SIGNAL(cut()), paintWidget, SLOT(trim()));
connect(this, SIGNAL(save_pic()), paintWidget, SLOT(savePic()));
connect(this, SIGNAL(import_pic()), paintWidget, SLOT(importPic()));
connect(this, SIGNAL(save_shape()), paintWidget, SLOT(saveShape()));
connect(this, SIGNAL(import_shape()), paintWidget, SLOT(importShape()));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_2_clicked()
{
emit changeCurrentShape(Shape::Line);
}
void MainWindow::on_pushButton_3_clicked()
{
emit changeCurrentShape(Shape::Circle);
}
void MainWindow::on_pushButton_clicked()
{
emit changeCurrentShape(Shape::Ellipse);
}
void MainWindow::on_pushButton_4_clicked()
{
emit sendClearSignal();
}
void MainWindow::on_pushButton_5_clicked()
{
emit changeCurrentShape(Shape::Polygon);
}
void MainWindow::on_pushButton_8_clicked()
{
emit fill();
}
void MainWindow::on_pushButton_7_pressed()
{
emit left();
}
void MainWindow::on_pushButton_6_pressed()
{
emit right();
}
void MainWindow::on_pushButton_9_pressed()
{
emit up();
}
void MainWindow::on_pushButton_10_pressed()
{
emit down();
}
void MainWindow::on_pushButton_11_pressed()
{
emit rotateR();
}
void MainWindow::on_pushButton_12_pressed()
{
emit rotateL();
}
void MainWindow::on_pushButton_13_pressed()
{
emit zoomin();
}
void MainWindow::on_pushButton_14_pressed()
{
emit zoomout();
}
void MainWindow::on_pushButton_15_clicked()
{
emit cut();
}
void MainWindow::on_bezier_clicked()
{
emit changeCurrentShape(Shape::Bezier);
}
void MainWindow::on_bspline_clicked()
{
emit changeCurrentShape(Shape::BSpline);
}
void MainWindow::on_savepic_clicked()
{
emit save_pic();
}
void MainWindow::on_importpic_clicked()
{
emit import_pic();
}
void MainWindow::on_saveshape_clicked()
{
emit save_shape();
}
void MainWindow::on_importshape_clicked()
{
emit import_shape();
}
void MainWindow::on_cube_released()
{
w = new OGLWidget;
w->show();
}