QObject: code snippets cleanup

Use chrono literals; remove comment about C++14.

Pick-to: 6.8
Change-Id: I1594780946dd3e646b5a4f68dad4996f0572f317
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2024-08-30 20:46:36 +03:00
parent 52fd8c716e
commit 81e3d10ca5

View File

@ -106,19 +106,11 @@ protected:
MyObject::MyObject(QObject *parent)
: QObject(parent)
{
startTimer(50); // 50-millisecond timer
startTimer(1000); // 1-second timer
startTimer(60000); // 1-minute timer
using namespace std::chrono_literals;
using namespace std::chrono;
startTimer(milliseconds(50));
startTimer(seconds(1));
startTimer(minutes(1));
// since C++14 we can use std::chrono::duration literals, e.g.:
startTimer(100ms);
startTimer(50ms);
startTimer(5s);
startTimer(2min);
startTimer(10min);
startTimer(1h);
}