diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-28 22:19:53 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-30 08:23:12 +0200 |
commit | b021286327abed031e75b6dd6fa67790f24a700a (patch) | |
tree | 7eff60ca10924392c1925e72ced355b0d72d4412 /vcl | |
parent | a44d515dd61f8e715c86ce1f05c3b4117a10c50d (diff) |
tdf#130857 qt a11y weld: Set GtkBuilder ID as widget's accessible ID
Set the GtkBuilder ID specified in .ui files as the accessible
ID for the QWidget created for the object, in line with what
happens for other implementations as well. This is basically
the equivalent of
commit c64b823b74cbd3063d6e87643bd68ea5343b2f54
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Tue Jul 16 13:57:41 2024 +0200
tdf#155447 qt a11y: Report accessible ID
for the case where native Qt widgets are used instead of
vcl::Window.
Other than QWidget, QLayout is not part of the a11y
hierarchy of an application, so there's nothing to
do for these.
This e.g. makes Accerciser show an accessible ID of
"LicenseDialog" for the "Help" -> "License Information"
dialog.
The accessible ID set this way currently isn't reported
on the AT-SPI level for QMessageBox (e.g. the "Save Document?"
dialog) however. Suggested upstream change to make that
work as well: [1]
[1] https://codereview.qt-project.org/c/qt/qtbase/+/594390
Change-Id: I50e8ca6f8bea628df5a80d101c4a0a7bfded9c19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174158
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/QtBuilder.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 3d702f34c250..4845d70209bf 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -149,12 +149,16 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons assert(false && "Widget type not supported yet"); } - // add widgets to parent layout - if (pParentLayout) + if (QWidget* pWidget = qobject_cast<QWidget*>(pObject)) { - QWidget* pWidget = qobject_cast<QWidget*>(pObject); - if (pWidget) + // add widget to parent layout + if (pParentLayout) pParentLayout->addWidget(pWidget); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) + // Set GtkBuilder ID as accessible ID + pWidget->setAccessibleIdentifier(toQString(sID)); +#endif } m_aChildren.emplace_back(sID, pObject); |