vcl/qt5/QtAccessibleEventListener.cxx |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 1dbf4a111486ee4e5e2d9da0bbf5544742ae7805
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Sep 1 11:11:39 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Sep 1 15:26:43 2022 +0200

    tdf#150683 qt a11y: Avoid using 32-bit child index here
    
    Passing the `QObject` of the child directly in the
    `QAccessibleEvent` ctor generally has the same effect
    as setting the parent in the ctor and then passing the
    child index via `QAccessibleEvent::setChild`. In both
    cases, `QAccessibleEvent::accessibleInterface` will
    return the `QAccessibleInterface*` for the child
    afterwards.
    
    However, the latter only works correctly with child
    indices that fit into 32 bit, which isn't the case
    for all cells in a Calc spreadsheet with 16k column
    support.
    
    Change-Id: Iaa7b936df237f82dc21a00d3ac419a1519a95226
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139147
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtAccessibleEventListener.cxx 
b/vcl/qt5/QtAccessibleEventListener.cxx
index 3716472b2d96..16a5a074b8cb 100644
--- a/vcl/qt5/QtAccessibleEventListener.cxx
+++ b/vcl/qt5/QtAccessibleEventListener.cxx
@@ -344,14 +344,10 @@ void QtAccessibleEventListener::notifyEvent(const 
css::accessibility::Accessible
                 return;
             }
 
-            // use the QAccessibleEvent ctor taking a QObject* instead of the 
one that takes QAccessibleInterface*
-            // to work around QTBUG-105988
-            QAccessibleEvent* pSelectionAddEvent
-                = new QAccessibleEvent(pQAccessibleInterface->object(), 
eEventType);
-            // Qt expects the index of the (un)selected child to be set in the 
event
-            sal_Int32 nChildIndex = xContext->getAccessibleIndexInParent();
-            pSelectionAddEvent->setChild(nChildIndex);
-            QAccessible::updateAccessibility(pSelectionAddEvent);
+            // Qt expects the event to be sent for the (un)selected child
+            QObject* pChildObject = 
QtAccessibleRegistry::getQObject(xChildAcc);
+            assert(pChildObject);
+            QAccessible::updateAccessibility(new 
QAccessibleEvent(pChildObject, eEventType));
             return;
         }
         case AccessibleEventId::SELECTION_CHANGED_WITHIN:

Reply via email to