Windows QPA/High DPI: Scale accessibility coordinates.
Use High DPI when interfacing with the Accessibility API. Task-number: QTBUG-52943 Task-number: QTBUG-50991 Change-Id: Ica4489222dca5d58864172470e634f709deb69f8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>bb10
parent
3d5e9a0ba1
commit
d7a3b61459
|
|
@ -39,6 +39,7 @@
|
|||
#include <QtGui/qaccessible.h>
|
||||
#include <QtGui/qclipboard.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -660,9 +661,11 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locationInParent(long *x, l
|
|||
QAccessibleInterface *parentIface = accessible->parent();
|
||||
if (parentIface && parentIface->isValid())
|
||||
topLeft -= parentIface->rect().topLeft();
|
||||
const QPoint nativeTopLeft = QHighDpi::toNativeLocalPosition(topLeft, accessible->window());
|
||||
|
||||
*x = topLeft.x();
|
||||
*y = topLeft.y();
|
||||
|
||||
*x = nativeTopLeft.x();
|
||||
*y = nativeTopLeft.y();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#include <QtGui/qguiapplication.h>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include <QtGui/qwindow.h>
|
||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||
|
||||
//#include <uiautomationcoreapi.h>
|
||||
#ifndef UiaRootObjectId
|
||||
|
|
@ -497,7 +498,8 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accHitTest(long xLeft, long yT
|
|||
if (!accessible)
|
||||
return E_FAIL;
|
||||
|
||||
QAccessibleInterface *child = accessible->childAt(xLeft, yTop);
|
||||
const QPoint pos = QHighDpi::fromNativeLocalPosition(QPoint(xLeft, yTop), accessible->window());
|
||||
QAccessibleInterface *child = accessible->childAt(pos.x(), pos.y());
|
||||
if (child == 0) {
|
||||
// no child found, return this item if it contains the coordinates
|
||||
if (accessible->rect().contains(xLeft, yTop)) {
|
||||
|
|
@ -539,7 +541,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long
|
|||
QAccessibleInterface *acc = childPointer(accessible, varID);
|
||||
if (!acc || !acc->isValid())
|
||||
return E_FAIL;
|
||||
const QRect rect = acc->rect();
|
||||
const QRect rect = QHighDpi::toNativePixels(acc->rect(), accessible->window());
|
||||
|
||||
*pxLeft = rect.x();
|
||||
*pyTop = rect.y();
|
||||
|
|
|
|||
Loading…
Reference in New Issue