-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy patherroricon.cpp
More file actions
40 lines (34 loc) · 771 Bytes
/
erroricon.cpp
File metadata and controls
40 lines (34 loc) · 771 Bytes
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
#include "erroricon.h"
ErrorIcon::ErrorIcon(QWidget *parent) : QWidget(parent)
{
framenum = 0;
frame = ":icons/error_a.png";
animation = new QTimer(this);
animation->setInterval(300);
animation->start();
connect(animation, &QTimer::timeout, this, &ErrorIcon::changeFrame);
}
void ErrorIcon::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QPixmap pframe(frame);
painter.drawPixmap(0,0,pframe.width(),pframe.height(),pframe);
}
void ErrorIcon::changeFrame()
{
if(framenum == 0)
{
frame = ":icons/error_a.png";
framenum = 1;
}
else if(framenum == 1)
{
frame = ":icons/error_b.png";
framenum = 0;
}
this->update();
}
ErrorIcon::~ErrorIcon()
{
animation->stop();
}