diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-09-01 11:11:39 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-09-01 15:26:43 +0200 |
commit | 1dbf4a111486ee4e5e2d9da0bbf5544742ae7805 (patch) | |
tree | fba5c74d847039f5e499cead1f35b374657d2fef /vcl/qt5 | |
parent | 603f9ce4f39a59bd84b5c08e3d725e0ee664991f (diff) |
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.weghorn@posteo.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/QtAccessibleEventListener.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
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: |