forked from shiyu-sz/QT_BinToTxt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
showdatetime.h
55 lines (44 loc) · 1.16 KB
/
showdatetime.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
#ifndef SHOWDATETIME_H
#define SHOWDATETIME_H
#include <QObject>
#include <QMutex>
#include <QLabel>
#include <QLCDNumber>
class QLabel;
class QLCDNumber;
class QTimer;
class ShowDateTime : public QObject
{
Q_OBJECT
public:
explicit ShowDateTime(QObject *parent = 0);
static ShowDateTime *Instance()
{
static QMutex mutex;
if (!self) {
QMutexLocker locker(&mutex);
if (!self) {
self = new ShowDateTime;
}
}
return self;
}
void SetLab(QLabel *labDateTime, QLabel *labLive);
void SetLcdNumber(QLCDNumber *lcdNumber);
void Start(int interval);
void Stop();
private:
static ShowDateTime *self;
int day; //天数
int hour; //时钟数
int minute; //分钟数
int seconds; //秒钟数
QTimer *timer; //定时器获取时间
QLabel *labDateTime; //显示日期时间的载体
QLabel *labLive; //显示已运行
QLCDNumber *lcdNumber; //显示日期时间的LCD控件
private slots:
void SetTimeInfo();
void ShowTime();
};
#endif // SHOWDATETIME_H