diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 71c197a32c..5550dd4efd 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -470,15 +470,6 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::Invoke(long dispIdMember, return hr; } -static const QWindow *windowOf(const QAccessibleInterface *ai) -{ - for ( ; ai; ai = ai->parent()) { - if (const QWindow *window = ai->window()) - return window; - } - return Q_NULLPTR; -} - /* IAccessible @@ -507,7 +498,8 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accHitTest(long xLeft, long yT if (!accessible) return E_FAIL; - const QPoint pos = QHighDpi::fromNativeLocalPosition(QPoint(xLeft, yTop), windowOf(accessible)); + const QPoint pos = QHighDpi::fromNativeLocalPosition(QPoint(xLeft, yTop), + QWindowsAccessibility::windowHelper(accessible)); QAccessibleInterface *child = accessible->childAt(pos.x(), pos.y()); if (child == 0) { // no child found, return this item if it contains the coordinates @@ -550,7 +542,8 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long QAccessibleInterface *acc = childPointer(accessible, varID); if (!acc || !acc->isValid()) return E_FAIL; - const QRect rect = QHighDpi::toNativePixels(acc->rect(), windowOf(accessible)); + const QRect rect = QHighDpi::toNativePixels(acc->rect(), + QWindowsAccessibility::windowHelper(accessible)); *pxLeft = rect.x(); *pyTop = rect.y();