81bee1ec4
김태훈
원격 패킷 출력 프로그램 추가
|
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
|
#include "tablevalue.h"
#include <QColor>
#include <QtDebug>
void TableValue::setText(const QString &str)
{
QLabel::setText(str);
timer.start(2000);
animationTimer.start(33);
updateColor();
}
void TableValue::updateColor()
{
int remain = timer.remainingTime();
if (remain < 0)
remain = 0;
if (remain > 2000)
remain = 2000;
qreal percentage = ((qreal) remain / 2000) * 0.5;
int b = 255 * percentage;
if (b < 0)
b = 0;
if (b > 255)
b = 255;
setStyleSheet(QString().sprintf("background-color: rgba(255, 0, 0, %d); color: rgb(0, 0, 0)", b));
}
|