How to display count down time in label qt?

How to make a countdown was displayed in the label,that's what I did but I have displays the current time
QTextStream in(&file);
 QTime start = QTime::currentTime();
 while (!in.atEnd())
{
 QString line = in.readLine();
 if (line.contains(v) || line.contains(s) || line.contains(k) || line.contains(m) || line.contains(q) || line.contains(r))
ui.textEdit->append(line);
ui.lineEdit_6->setText(QString().number(ui.textEdit->document()->lineCount()));
}
 Finish QTime = QTime::currentTime();
 QString time;
ui.label->setText((finish.toString("")));
 }
April 19th 20 at 12:45
1 answer
April 19th 20 at 12:47
Solution
QTime::toString() for timer is better not to use. he would rather just to display time in a specific format. What to count elapsed time better to do so:
__int64 start = QDateTime::currentMSecsSinceEpoch();
/*
*
*
*
*
*
*/
 __int64 duration = QDateTime::currentMSecsSinceEpoch() - start;
 ui->label->setText(QString::number(duration));

Find more questions by tags C++Qt