-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart_moive.cpp
More file actions
48 lines (46 loc) · 1.05 KB
/
Copy pathstart_moive.cpp
File metadata and controls
48 lines (46 loc) · 1.05 KB
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
#include "start_moive.h"
#include "ui_start_moive.h"
start_moive::start_moive(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::start_moive)
{
ui->setupUi(this);
this->setAttribute(Qt::WA_TranslucentBackground, true);//透明
setWindowFlags(Qt::FramelessWindowHint);
}
start_moive::~start_moive()
{
delete ui;
}
void start_moive :: mousePressEvent(QMouseEvent *e)
{
last = e -> globalPos();
}
void start_moive :: mouseMoveEvent(QMouseEvent *e)
{
int dx = e -> globalX() - last.x();
int dy = e -> globalY() - last.y();
last = e -> globalPos();
move(x() + dx, y() + dy);
}
void start_moive :: mouseReleaseEvent(QMouseEvent *e)
{
int dx = e -> globalX() - last.x();
int dy = e -> globalY() - last.y();
move(x() + dx, y() + dy);
}
void start_moive :: work()
{
show();
QTime time;
QMovie *movie;
movie = new QMovie( "../2.gif" );
ui -> label -> setMovie( movie );
movie -> start();
time.start();
while ( time.elapsed() < 4500 )
{
QApplication::processEvents();
}
close();
}