23class ScopedQCoreApplication
26 ScopedQCoreApplication ()
29 char ** argv =
nullptr;
30 app_ = std::make_unique<QCoreApplication> (argc, argv);
39 const std::function<
bool ()> &cond,
40 unsigned int max_calls = 100)
42 for (
unsigned int i = 0; i < max_calls && !cond (); ++i)
44 QCoreApplication::processEvents (QEventLoop::AllEvents, 50);
48 throw std::runtime_error (
"condition failed");
52 static void process_events_until_timeout (
53 std::chrono::milliseconds time = std::chrono::milliseconds (200))
57 while (timer.durationElapsed () < time)
59 QCoreApplication::processEvents (QEventLoop::AllEvents, 50);
64 std::unique_ptr<QCoreApplication> app_;