vcl/qt5/QtAccessibleWidget.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 2de74491a5a7b2183cce977f8ffaf81d0df11d75
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Aug 10 16:59:50 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Aug 11 08:47:21 2022 +0200

    qt a11y: Use correct coord system in QtAccessibleWidget::childAt
    
    `QAccessibleInterface::childAt` uses screen coordinates,
    but `XAccessibleComponent::getAccessibleAtPoint` wants
    local coordinates (i.e. coordinates relative to the
    object's top left corner), so convert accordingly.
    
    Change-Id: I61ab695ea6fdaf336903a0dc7d4c50c90a14e656
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138096
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index 90f345919ef7..c0ed4a2096f7 100644
--- a/vcl/qt5/QtAccessibleWidget.cxx
+++ b/vcl/qt5/QtAccessibleWidget.cxx
@@ -711,8 +711,11 @@ QAccessibleInterface* QtAccessibleWidget::childAt(int x, 
int y) const
         return nullptr;
 
     Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY);
+    // convert from screen to local coordinates
+    QPoint aLocalCoords = QPoint(x, y) - rect().topLeft();
     return QAccessible::queryAccessibleInterface(
-        new 
QtXAccessible(xAccessibleComponent->getAccessibleAtPoint(awt::Point(x, y))));
+        new QtXAccessible(xAccessibleComponent->getAccessibleAtPoint(
+            awt::Point(aLocalCoords.x(), aLocalCoords.y()))));
 }
 
 QAccessibleInterface* QtAccessibleWidget::customFactory(const QString& 
classname, QObject* object)

Reply via email to