Use closest QWindow when waiting for a widget to become active/exposed

A child widget without a native handle would previously not be treated as
exposed or active, even if the closest QWindow actually was, resulting
in qWaitFor returning false and QVERIFY failing.

Change-Id: I9df41cbac7aeab63bfa59d8ac77880591393c085
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
bb10
Tor Arne Vestbø 2016-12-16 15:48:00 +01:00
parent 6d5b07c509
commit 2debae1600
1 changed files with 2 additions and 2 deletions

View File

@ -116,14 +116,14 @@ namespace QTest
#ifdef QT_WIDGETS_LIB
inline static bool qWaitForWindowActive(QWidget *widget, int timeout = 1000)
{
if (QWindow *window = widget->windowHandle())
if (QWindow *window = widget->window()->windowHandle())
return qWaitForWindowActive(window, timeout);
return false;
}
inline static bool qWaitForWindowExposed(QWidget *widget, int timeout = 1000)
{
if (QWindow *window = widget->windowHandle())
if (QWindow *window = widget->window()->windowHandle())
return qWaitForWindowExposed(window, timeout);
return false;
}