Fix QWindowsAccessible::GetWindow()

Since we added QAI::window() we now have a more reliable way of
getting hold of a HWND.

Change-Id: I330ecee67f041d5b204ef4bc1401ce4cc76de2b7
Reviewed-on: http://codereview.qt-project.org/5840
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
Jan-Arve Saether 2011-09-22 16:10:35 +02:00 committed by Qt by Nokia
parent 5bfeab8749
commit 7e1a12d07d

View File

@ -1203,28 +1203,14 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::GetWindow(HWND *phwnd)
if (!accessible->isValid())
return E_UNEXPECTED;
QObject *o = accessible->object();
QWindow *window = qobject_cast<QWindow*>(o);
QWindow *window = accessible->window();
if (!window)
window = QGuiApplication::topLevelWindows().first();
Q_ASSERT(window);
if (!o || !window)
return E_FAIL;
#ifdef Q_WS_QPA
//QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
//Q_ASSERT(platform);
//*phwnd = (HWND)platform->nativeResourceForWindow("handle", window);
QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
Q_ASSERT(platform);
*phwnd = (HWND)platform->nativeResourceForWindow("handle", window);
return S_OK;
#else
*phwnd = static_cast<QWidget*>(o)->effectiveWinId();
return S_OK;
#endif
}
HRESULT STDMETHODCALLTYPE QWindowsAccessible::ContextSensitiveHelp(BOOL)