-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
132 lines (113 loc) · 3.28 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMouseEvent>
#include <QThread>
#include <QGraphicsOpacityEffect>
#include <QPropertyAnimation>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setWindowIcon(QIcon(":icon.png"));
ui->progress->setValue(5);
ui->pass->hide();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_Test_clicked()
{
//hide();
int small = 33;
while(small < 66) {
ui->progress->setValue(small);
small+=2;
QThread::msleep(40);
}
QPropertyAnimation *a = new QPropertyAnimation(this,"windowOpacity");
a->setStartValue(1.0);
a->setDuration(400);
a->setEndValue(0.0);
a->setEasingCurve(QEasingCurve::InSine);
a->start(QPropertyAnimation::DeleteWhenStopped);
connect(a,SIGNAL(finished()),this,SLOT(hide()));
test_w = new test_wind(this);
int x = geometry().x();
int y = geometry().y();
test_w->move(x, y);
test_w->show();
}
void MainWindow::mousePressEvent(QMouseEvent *event) {
m_nMouseClick_X_Coordinate = event->position().x();
m_nMouseClick_Y_Coordinate = event->position().y();
qDebug() << m_nMouseClick_X_Coordinate << " 1 " << m_nMouseClick_Y_Coordinate;
}
void MainWindow::mouseMoveEvent(QMouseEvent *event) {
move(event->globalPosition().x()-m_nMouseClick_X_Coordinate,event->globalPosition().y()-m_nMouseClick_Y_Coordinate);
qDebug() << m_nMouseClick_X_Coordinate << " 2 " << m_nMouseClick_Y_Coordinate;
}
void MainWindow::on_execute_clicked()
{
this->close();
}
void MainWindow::on_swish_clicked()
{
this->showMinimized();
}
void MainWindow::on_Settings_clicked()
{
int small = 5;
while(small < 33) {
ui->progress->setValue(small);
small+=2;
QThread::msleep(40);
}
QPropertyAnimation *a = new QPropertyAnimation(this,"windowOpacity");
a->setStartValue(1.0);
a->setDuration(400);
a->setEndValue(0.0);
a->setEasingCurve(QEasingCurve::InSine);
a->start(QPropertyAnimation::DeleteWhenStopped);
connect(a,SIGNAL(finished()),this,SLOT(hide()));
settin = new settings(this);
int x = geometry().x();
int y = geometry().y();
settin->move(x, y);
settin->show();
}
void MainWindow::on_Paper_clicked()
{
int small = 66;
while(small < 100) {
ui->progress->setValue(small);
small+=2;
QThread::msleep(40);
}
QPropertyAnimation *a = new QPropertyAnimation(this,"windowOpacity");
a->setStartValue(1.0);
a->setDuration(400);
a->setEndValue(0.0);
a->setEasingCurve(QEasingCurve::InSine);
a->start(QPropertyAnimation::DeleteWhenStopped);
connect(a,SIGNAL(finished()),this,SLOT(hide()));
quest = new questions(this);
int x = geometry().x();
int y = geometry().y();
quest->move(x, y);
quest->show();
//add an animation plz later
ui->pass->show();
}
void MainWindow::on_pass_clicked()
{
int small = 98;
while(small > 5) {
ui->progress->setValue(small);
small-=2;
QThread::msleep(30);
}
ui->pass->hide();
}