vcl/qt5/QtBuilder.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
New commits: commit 95e2bdf97d987c845927bd44210547fd3c2f2387 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Oct 4 23:03:54 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sat Oct 5 09:40:15 2024 +0200 tdf#130857 qt a11y weld: Convert accelerator for labels Convert the accelerator from GTK to Qt convention for labels as well, to not display a literal "_", but use the next letter as the accelerator. For Qt, a literal "&" would still be displayed if no buddy is actually set, i.e. there is no related widget that can receive keyboard focus when the accelerator key is pressed together with Alt. Setting buddies was implemented in previous commit Change-Id: Iba1e766c0f2c5162beb5b938c134afab0dac68b7 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Fri Oct 4 22:56:05 2024 +0200 tdf#130857 qt a11y weld: Set "buddy" (mnemonic widget) . Together with the above commit, this commit makes the "Alt Text" label in the "Alt Text" dialog (cui/ui/objecttitledescdialog.ui) show up as expected with qt6 in a WIP branch that declares that .ui file as supported in QtInstanceBuilder::IsUIFileSupported, while it was previously shown as "_Alt Text". Change-Id: Ief58dfc6864da9043766eec4eec36da44ae7017b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174511 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index e47b740fd88f..db8a8f1033f0 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -354,7 +354,7 @@ void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) for (auto const & [ rKey, rValue ] : rProps) { if (rKey == u"label") - pLabel->setText(toQString(rValue)); + pLabel->setText(convertAccelerator(rValue)); else if (rKey == u"wrap") pLabel->setWordWrap(toBool(rValue)); } commit 9df896fe542f474f7fe6972b3c5ebc8bd228bb52 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Oct 4 22:56:05 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sat Oct 5 09:40:07 2024 +0200 tdf#130857 qt a11y weld: Set "buddy" (mnemonic widget) Based on previous commits Change-Id: I878eec7be5e82fac3e1b944d7fed7bf6711744ce Author: Michael Weghorn <m.wegh...@posteo.de> Date: Fri Oct 4 22:04:08 2024 +0200 tdf#130857 VclBuilder: Move mnemonic-widget bookkeeping to base class and Change-Id: I32c922f91e5e1d06c003e6d26a4342cbb98942e1 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Fri Oct 4 22:18:17 2024 +0200 tdf#130857 VclBuilder: Extract setMnemonicWidget helper + call from base , implement handling for mnemonic widgets for labels for native Qt widgets in QtBuilder: * call BuilderBase::extractMnemonicWidget when processing a "GtkLabel" object, in the same way that VclBuilder does that. * implement actually setting the mnemonic widget by calling QLabel::setBuddy [1] in QtBuilder::setMnemonicWidget to set the "buddy" (mnemonic widget) This makes Orca in a WIP branch to support a native qt6 "Alt Text" dialog announce the label text as well when the corresponding QLineEdit/QPlainTextEdit receives focus, as setting the buddy also ensures that the accessible labelledy-by/label-for relations get reported on the AT-SPI layer, see also commit 09789838bbbe57d207a66532b38cbba67ec59d70 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Fri Oct 4 21:39:44 2024 +0200 tdf#119931: cui a11y: Specify mnenomic-widget in "Alt Text" dialog which describes the scenario a bit more for the gtk3 variant. [1] https://doc.qt.io/qt-6/qlabel.html#setBuddy Change-Id: Iba1e766c0f2c5162beb5b938c134afab0dac68b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174510 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 293399affc08..e47b740fd88f 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -157,6 +157,7 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons } else if (sName == u"GtkLabel") { + extractMnemonicWidget(sID, rMap); pObject = new QLabel(pParentWidget); } else if (sName == u"GtkScrolledWindow") @@ -249,9 +250,15 @@ void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std } } -void QtBuilder::setMnemonicWidget(const OUString&, const OUString&) +void QtBuilder::setMnemonicWidget(const OUString& rLabelId, const OUString& rMnemonicWidgetId) { - SAL_WARN("vcl.qt", "QtBuilder::setMnemonicWidget not implemented yet"); + QLabel* pLabel = get<QLabel>(rLabelId); + QObject* pBuddy = get_by_name(rMnemonicWidgetId); + + if (!pLabel || !pBuddy || !pBuddy->isWidgetType()) + return; + + pLabel->setBuddy(static_cast<QWidget*>(pBuddy)); } void QtBuilder::setPriority(QObject*, int) { SAL_WARN("vcl.qt", "Ignoring priority"); }