diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-11-22 18:08:05 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-19 12:27:45 +0100 |
commit | 74c9f9d83f9f5cb934d0b62b468c74df5a3b9a0d (patch) | |
tree | ea5e783b8d025ce2d525dab5c524aaee298dd6b9 /src/plugins/platforms/windows/qwindowsaccessibility.cpp | |
parent | 7e12d2d30f74b5fe1f80fac7192416cf6eb22d4d (diff) |
Accessibility: childAt returns interface
childAt used to return an integer.
Return an interface instead.
Not requiring a direct child to be returned allows optimizing
by bypassing iterating through the hierarchy of accessibles.
For QtQuick this is the only sensible way of implementing this.
The bridges are still responsible for finding the top-most element.
The default implementation in QAccessibleObject is sufficient
to return direct children. The implementation in
QAccessibleApplication is therfore no longer needed.
Change-Id: Id7100dd5bcc3a98de516a7f4a12eaaa41cb46d26
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsaccessibility.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsaccessibility.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/qwindowsaccessibility.cpp index aa4507484d..53d7b33769 100644 --- a/src/plugins/platforms/windows/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/qwindowsaccessibility.cpp @@ -753,21 +753,23 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accHitTest(long xLeft, long yTop, if (!accessible->isValid()) return E_FAIL; - int control = accessible->childAt(xLeft, yTop); - if (control == -1) { + QAccessibleInterface *child = accessible->childAt(xLeft, yTop); + if (child == 0) { + // no child found, return this item if it contains the coordinates + if (accessible->rect().contains(xLeft, yTop)) { + IDispatch *iface = 0; + QueryInterface(IID_IDispatch, (void**)&iface); + if (iface) { + (*pvarID).vt = VT_DISPATCH; + (*pvarID).pdispVal = iface; + return S_OK; + } + } (*pvarID).vt = VT_EMPTY; return S_FALSE; } - QAccessibleInterface *acc = 0; - if (control) - accessible->navigate(QAccessible::Child, control, &acc); - if (!acc) { - (*pvarID).vt = VT_I4; - (*pvarID).lVal = control; - return S_OK; - } - QWindowsAccessible* wacc = new QWindowsAccessible(acc); + QWindowsAccessible* wacc = new QWindowsAccessible(child); IDispatch *iface = 0; wacc->QueryInterface(IID_IDispatch, (void**)&iface); if (iface) { |