-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathzoomeffect.cpp
More file actions
94 lines (83 loc) · 3.29 KB
/
zoomeffect.cpp
File metadata and controls
94 lines (83 loc) · 3.29 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
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
/*===========================================
*滚动滑轮放大缩小地图时鼠标指针周围箭头的移动
*模块重要性:一般
*作者:杨飞
*
*--------------------------------------------
*变更履历:
*============================================*/
#include "zoomeffect.h"
#include "ui_zoomeffect.h"
ZoomEffect::ZoomEffect(QWidget *parent) :
QWidget(parent),
ui(new Ui::ZoomEffect)
{
ui->setupUi(this);
setLayout(ui->zoomLayout);
setVisible(false);
}
ZoomEffect::~ZoomEffect()
{
delete ui;
}
/*==================================
*加载鼠标周围呈缩小放大状的4个箭头
*==================================*/
void ZoomEffect::zoomInEffect()
{
ui->label_1->setPixmap(QPixmap(":/images/1.png"));
ui->label_2->setPixmap(QPixmap(":/images/2.png"));
ui->label_3->setPixmap(QPixmap(":/images/3.png"));
ui->label_4->setPixmap(QPixmap(":/images/4.png"));
this->setStyleSheet("border-image:none");
setVisible(true);
QPropertyAnimation *animation1 = new QPropertyAnimation(ui->label_1, "geometry");
animation1->setDuration(400);
animation1->setStartValue(QRect(24, 18, 20, 20));
animation1->setEndValue(QRect(0, 0, 20, 20));
animation1->start();
QPropertyAnimation *animation2 = new QPropertyAnimation(ui->label_2, "geometry");
animation2->setDuration(400);
animation2->setStartValue(QRect(72, 18, 20, 20));
animation2->setEndValue(QRect(96, 0, 20, 20));
animation2->start();
QPropertyAnimation *animation3 = new QPropertyAnimation(ui->label_3, "geometry");
animation3->setDuration(400);
animation3->setStartValue(QRect(72, 54, 20, 20));
animation3->setEndValue(QRect(96, 72, 20, 20));
animation3->start();
QPropertyAnimation *animation4 = new QPropertyAnimation(ui->label_4, "geometry");
animation4->setDuration(400);
animation4->setStartValue(QRect(24, 54, 20, 20));
animation4->setEndValue(QRect(0, 72, 20, 20));
animation4->start();
}
void ZoomEffect::zoomOutEffect()
{
ui->label_1->setPixmap(QPixmap(":/images/5.png"));
ui->label_2->setPixmap(QPixmap(":/images/6.png"));
ui->label_3->setPixmap(QPixmap(":/images/7.png"));
ui->label_4->setPixmap(QPixmap(":/images/8.png"));
//this->setStyleSheet("border-image:none");
setVisible(true);
QPropertyAnimation *animation1 = new QPropertyAnimation(ui->label_1, "geometry");
animation1->setDuration(400);
animation1->setStartValue(QRect(0, 0, 20, 20));
animation1->setEndValue(QRect(24, 18, 20, 20));
animation1->start();
QPropertyAnimation *animation2 = new QPropertyAnimation(ui->label_2, "geometry");
animation2->setDuration(400);
animation2->setStartValue(QRect(96, 0, 20, 20));
animation2->setEndValue(QRect(72, 18, 20, 20));
animation2->start();
QPropertyAnimation *animation3 = new QPropertyAnimation(ui->label_3, "geometry");
animation3->setDuration(400);
animation3->setStartValue(QRect(96, 72, 20, 20));
animation3->setEndValue(QRect(72, 54, 20, 20));
animation3->start();
QPropertyAnimation *animation4 = new QPropertyAnimation(ui->label_4, "geometry");
animation4->setDuration(400);
animation4->setStartValue(QRect(0, 72, 20, 20));
animation4->setEndValue(QRect(24, 54, 20, 20));
animation4->start();
}