21static bool qWaitForWidgetWindow(QWidget *w, Predicate predicate, QDeadlineTimer timeout)
23 if (!w->window()->windowHandle())
26 return QTest::qWaitFor([&, wp = QPointer(w)]() {
27 using QTest::Internal::WaitForResult;
28 if (QWidget *widget = wp.data(); !widget)
29 return WaitForResult::Failed;
30 else if (QWindow *window = widget->window()->windowHandle(); window && predicate(window))
31 return WaitForResult::Done;
32 return WaitForResult::NotYet;
65 if (Q_UNLIKELY(!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))) {
66 qWarning() <<
"qWaitForWindowActive was called on a platform that doesn't support window"
67 <<
"activation. This means there is an error in the test and it should either"
68 <<
"check for the WindowActivation platform capability before calling"
69 <<
"qWaitForWindowActivate, use qWaitForWindowExposed instead, or skip the test."
70 <<
"Falling back to qWaitForWindowExposed.";
71 return qWaitForWindowExposed(widget, timeout);
73 return qWaitForWidgetWindow(widget,
74 [&](QWindow *window) {
return window->isActive(); },