15 #include <QHBoxLayout>
25 mTimer =
new QTimer(
this);
26 connect(mTimer, SIGNAL(timeout()),
this, SLOT(timeoutSlot()));
27 mTimer->setInterval(1000);
29 QHBoxLayout* layout =
new QHBoxLayout(
this);
33 layout->addWidget(mLabel);
43 if (mTimer->isActive())
45 mStartTime = QDateTime::currentDateTime();
53 this->printText(
"green");
59 this->printText(
"red");
62 void DisplayTimerWidget::timeoutSlot()
64 this->printText(
"black");
67 void DisplayTimerWidget::printText(QString color)
70 mLabel->setText(QString(
"<font size=%1 color=%2><b>%3 s</b></font>").arg(mFontSize).arg(color).arg(secs));
75 return mStartTime.secsTo(QDateTime::currentDateTime());