diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2017-02-13 12:02:29 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2017-03-16 20:05:34 +0000 |
commit | b21069d6fa74273afbdab9af3a6ac89038e4a2b8 (patch) | |
tree | ba24b1279db34e14c472e3bf1477b4451fcfb795 /src/plugins | |
parent | 5cda0172e0eb912ef4814f3c5618686cbb1a5da1 (diff) |
Android: Fix Accessibility items positioning with QHighDpi enabled
the View's position and metrics are in pixels, not points
Change-Id: I285d5378db98187f54019bff9b8a1cde05dc3b35
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/android/androidjniaccessibility.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index 3b1ce6d21d..eeaecd53b4 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -49,6 +49,7 @@ #include <QtCore/qmath.h> #include <QtCore/private/qjnihelpers_p.h> #include <QtCore/private/qjni_p.h> +#include <QtGui/private/qhighdpiscaling_p.h> #include "qdebug.h" @@ -137,7 +138,7 @@ namespace QtAndroidAccessibility QRect rect; QAccessibleInterface *iface = interfaceFromId(objectId); if (iface && iface->isValid()) { - rect = iface->rect(); + rect = QHighDpi::toNativePixels(iface->rect(), iface->window()); } jclass rectClass = env->FindClass("android/graphics/Rect"); @@ -150,11 +151,13 @@ namespace QtAndroidAccessibility { QAccessibleInterface *root = interfaceFromId(-1); if (root) { - QAccessibleInterface *child = root->childAt((int)x, (int)y); + QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window()); + + QAccessibleInterface *child = root->childAt(pos.x(), pos.y()); QAccessibleInterface *lastChild = 0; while (child && (child != lastChild)) { lastChild = child; - child = child->childAt((int)x, (int)y); + child = child->childAt(pos.x(), pos.y()); } if (lastChild) return QAccessible::uniqueId(lastChild); |