vcl/qt5/QtAccessibleWidget.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
New commits: commit a3f3453c00f701ea51f67896e633bb6b6a6a2d71 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Aug 16 10:38:46 2022 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Aug 16 13:13:46 2022 +0200 qt a11y: Implement QtAccessibleWidget::indexOfChild With this in place, selecting an object in Accerciser's tree view of the LO a11y hierarchy and then calling the method to get the child index returns the actual child index instead of just 0, e.g.: In [24]: acc.getIndexInParent() Out[24]: 4 Change-Id: Ia3d4811226d6ffc82b86ed5a9abf3332b8b50b0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138347 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 9d2b17f86de7..7fa4cd297778 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -145,7 +145,23 @@ int QtAccessibleWidget::childCount() const return xAc->getAccessibleChildCount(); } -int QtAccessibleWidget::indexOfChild(const QAccessibleInterface* /* child */) const { return 0; } +int QtAccessibleWidget::indexOfChild(const QAccessibleInterface* pChild) const +{ + const QtAccessibleWidget* pAccessibleWidget = dynamic_cast<const QtAccessibleWidget*>(pChild); + if (!pAccessibleWidget) + { + SAL_WARN( + "vcl.qt", + "QtAccessibleWidget::indexOfChild called with child that is no QtAccessibleWidget"); + return -1; + } + + Reference<XAccessibleContext> xContext = pAccessibleWidget->getAccessibleContextImpl(); + if (!xContext.is()) + return -1; + + return xContext->getAccessibleIndexInParent(); +} namespace {