summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-10-04 22:56:05 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-10-05 09:40:07 +0200
commit9df896fe542f474f7fe6972b3c5ebc8bd228bb52 (patch)
tree0811120a33ab305009e0828c142c1142ae341e5a /vcl
parentb54ffcb1337fb76c8c29ce6145c914f80c7f95b5 (diff)
tdf#130857 qt a11y weld: Set "buddy" (mnemonic widget)
Based on previous commits Change-Id: I878eec7be5e82fac3e1b944d7fed7bf6711744ce Author: Michael Weghorn <m.weghorn@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.weghorn@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.weghorn@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.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/QtBuilder.cxx11
1 files changed, 9 insertions, 2 deletions
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"); }