The following code :
#include <QtWidgets>
#include "u.h"
DigitalClock
::DigitalClock(QWidget *parent
){
setSegmentStyle(Filled);
connect(timer, SIGNAL(timeout()), this, SLOT(showTime()));
timer->start(1000);
showTime();
setWindowTitle(tr("Digital Clock"));
resize(150, 60);
}
void DigitalClock::showTime()
{
[COLOR
="#FF0000"] QTime time = QTime:: currentTime();
[/COLOR
] QString text
= time.
toString("hh:mm");
if ((time.second() % 2) == 0)
#include <QtWidgets>
#include "u.h"
DigitalClock::DigitalClock(QWidget *parent)
: QLCDNumber(parent)
{
setSegmentStyle(Filled);
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(showTime()));
timer->start(1000);
showTime();
setWindowTitle(tr("Digital Clock"));
resize(150, 60);
}
void DigitalClock::showTime()
{
[COLOR="#FF0000"] QTime time = QTime:: currentTime(); [/COLOR]
QString text = time.toString("hh:mm");
if ((time.second() % 2) == 0)
To copy to clipboard, switch view to plain text mode
"this",where to point?
thanks.
Bookmarks