From 812fe185fba48b439fb1229517d62aa67c209016 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 24 Aug 2022 11:42:04 +0200 Subject: qt a11y: Remember and reuse existing QObject for XAccessible Previously, a new `QtXAccessible` object was created for an `XAccessible` each time before `QAccessible::queryAccessibleInterface` was called, which is not only unnecessary but also causes various issues, e.g. it breaks walking the a11y hierarchy upwards (i.e. from children to parents), since a new object is created for the parent. This introduces `QtAccessibleRegistry` that keeps a mapping between the `XAccessible` and the associated `QObject`. That mapping is used to reuse already created objects instead of creating new ones for the same `XAccessible`. The entry for an `XAccessible` is removed again from the map in `QtAccessibleWidget::invalidate`, which gets called when the `XAccessible` gets disposed, s. `QtAccessibleEventListener::disposing`. With this in place, Orca now also nicely announces only the text of the push buttons themselves in the "Save Document?" dialog when switching between the buttons using the Tab key, rather than announcing the whole widget hierarchy every time (probably because creating a new object every time prevented Orca from recognizing that the previously selected pushbutton and the newly selected one are siblings, i.e. have the same parent object.) Change-Id: Ic890a387ff016e889f25dba70c82d0d81ae7a9e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138757 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/qt6/QtAccessibleRegistry.hxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 vcl/inc/qt6/QtAccessibleRegistry.hxx (limited to 'vcl/inc/qt6') diff --git a/vcl/inc/qt6/QtAccessibleRegistry.hxx b/vcl/inc/qt6/QtAccessibleRegistry.hxx new file mode 100644 index 000000000000..b29fbb32633e --- /dev/null +++ b/vcl/inc/qt6/QtAccessibleRegistry.hxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtAccessibleRegistry.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit