added hours to display
This commit is contained in:
@@ -94,18 +94,20 @@ void MainWindow::shutdown()
|
|||||||
void MainWindow::updateTime()
|
void MainWindow::updateTime()
|
||||||
{
|
{
|
||||||
if (mTimeLeft == 0) {
|
if (mTimeLeft == 0) {
|
||||||
ui->lbl_timer->setText("00:00");
|
ui->lbl_timer->setText("0:00:00");
|
||||||
shutdown();
|
shutdown();
|
||||||
mTimer.stop();
|
mTimer.stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString m = QString::number(mTimeLeft / 60);
|
QString h = QString::number(mTimeLeft / 3600);
|
||||||
|
QString m = QString::number((mTimeLeft / 60) % 60);
|
||||||
QString s = QString::number(mTimeLeft % 60);
|
QString s = QString::number(mTimeLeft % 60);
|
||||||
|
|
||||||
if (s.length() == 1) s = "0" + s;
|
if (s.length() == 1) s = "0" + s;
|
||||||
|
if (m.length() == 1) m = "0" + m;
|
||||||
|
|
||||||
ui->lbl_timer->setText(m + ":" + s);
|
ui->lbl_timer->setText(h + ":" + m + ":" + s);
|
||||||
mTimeLeft--;
|
mTimeLeft--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +124,7 @@ void MainWindow::timerToggled() {
|
|||||||
} else {
|
} else {
|
||||||
mTimeLeft = -1;
|
mTimeLeft = -1;
|
||||||
mTimer.stop();
|
mTimer.stop();
|
||||||
ui->lbl_timer->setText("-- : --");
|
ui->lbl_timer->setText("--:--:--");
|
||||||
ui->stackedWidget->setCurrentIndex(0);
|
ui->stackedWidget->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>279</width>
|
<width>281</width>
|
||||||
<height>118</height>
|
<height>118</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
<enum>QFrame::Sunken</enum>
|
<enum>QFrame::Sunken</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>-- : --</string>
|
<string>--:--:--</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
|
|||||||
Reference in New Issue
Block a user