mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
28 lines
500 B
C
28 lines
500 B
C
|
#ifndef WAITTIME_H
|
||
|
#define WAITTIME_H
|
||
|
|
||
|
#include <QEventLoop>
|
||
|
#include <QTimer>
|
||
|
|
||
|
#include <chrono>
|
||
|
|
||
|
inline void wait(std::chrono::milliseconds millisecondsWait)
|
||
|
{
|
||
|
QEventLoop loop;
|
||
|
QTimer t;
|
||
|
t.connect(&t, &QTimer::timeout, &loop, &QEventLoop::quit);
|
||
|
t.start(millisecondsWait.count());
|
||
|
loop.exec();
|
||
|
}
|
||
|
|
||
|
inline void wait(int millisecondsWait)
|
||
|
{
|
||
|
QEventLoop loop;
|
||
|
QTimer t;
|
||
|
t.connect(&t, &QTimer::timeout, &loop, &QEventLoop::quit);
|
||
|
t.start(millisecondsWait);
|
||
|
loop.exec();
|
||
|
}
|
||
|
|
||
|
#endif // WAITTIME_H
|