-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinfowidget.h
61 lines (47 loc) · 1.37 KB
/
infowidget.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
#ifndef INFOWIDGET_H
#define INFOWIDGET_H
#include <QWidget>
#include <QSize>
#include <QDesktopWidget>
#include <QLabel>
#include <QPropertyAnimation>
#include <QTimer>
#include <QGraphicsDropShadowEffect>
#include <QMouseEvent>
namespace Ui {
class InfoWidget;
}
class InfoWidget : public QWidget
{
Q_OBJECT
public:
explicit InfoWidget(QWidget *parent = nullptr);
~InfoWidget();
void setName (QString n) { this->name = n; };
void setDuration (QString dur) { this->duration = dur; };
void setInfo (QString i) { this->info = i; };
void setCover (QImage c) { this->cover = c; };
void popup(int duration);
void reset() { if (timer != nullptr) timer->stop(); }
private:
Ui::InfoWidget * ui;
QTimer * timer = nullptr;
QString name;
QString duration;
QString info;
QImage cover;
QLabel * bg;
QLabel * trackName;
QLabel * trackInfo;
void mouseMoveEvent (QMouseEvent * event) {
if (this->underMouse() || bg->underMouse() || trackName->underMouse() || trackInfo->underMouse()) {
timer->stop();
QPropertyAnimation * animation = new QPropertyAnimation(this, "windowOpacity");
animation->setDuration(200);
animation->setStartValue(this->windowOpacity());
animation->setEndValue(0);
animation->start();
}
};
};
#endif // INFOWIDGET_H