Warning, /sdk/clazy/tests/use-chrono-in-qtimer/main.cpp.fixed.expected is written in an unsupported language. File is not indexed.

0001 #include <QtCore/QObject>
0002 #include <QtCore/QString>
0003 #include <QtCore/QTimer>
0004 #include <chrono>
0005 
0006 using namespace std::chrono_literals;
0007 
0008 void test()
0009 {
0010     QTimer timer;
0011 
0012     timer.setInterval(1s); // Warn
0013     timer.setInterval(1200ms); // Warn
0014     timer.setInterval(2min); // Warn
0015     timer.setInterval(5h); // Warn
0016     timer.setInterval(1min); // Warn
0017     timer.setInterval(15min); // Warn
0018     timer.setInterval(1000+1000); // Not really worth it
0019     timer.setInterval(1s); // OK
0020     timer.setInterval(1200ms); // OK
0021     timer.setInterval(0); // OK
0022 
0023     timer.start(15s); // Warn
0024     timer.start(15s); // OK
0025     timer.start(); // OK
0026 
0027     timer.singleShot(1s, [] {}); // Warn
0028     QTimer::singleShot(1s, [] {}); // Warn
0029 }