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 (
49 "process_events_until_true: condition failed after timeout");
53 static void process_events_until_timeout (
54 std::chrono::milliseconds time = std::chrono::milliseconds (200))
58 while (timer.durationElapsed () < time)
60 QCoreApplication::processEvents (QEventLoop::AllEvents, 50);
65 std::unique_ptr<QCoreApplication> app_;