更新
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
#include "toptime.h"
|
||||
#include <QDateTime>
|
||||
|
||||
topTime::topTime(QObject *parent) : QObject(parent)
|
||||
{
|
||||
current_time = QDateTime::currentDateTime();
|
||||
str=current_time.toString("hh:mm");
|
||||
timer=new QTimer(this);
|
||||
connect(timer,&QTimer::timeout,this,&topTime::refresh);
|
||||
timer->start(1000);
|
||||
}
|
||||
|
||||
void topTime::refresh()
|
||||
{
|
||||
current_time = QDateTime::currentDateTime();
|
||||
str=current_time.toString("hh:mm");
|
||||
emit refreshed();
|
||||
}
|
||||
Reference in New Issue
Block a user