summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/QtBuilder.cxx2
-rw-r--r--vcl/qt5/QtInstanceWidget.cxx31
2 files changed, 31 insertions, 2 deletions
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 0ada179178e2..ad402df02043 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -165,6 +165,8 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons
if (pParentLayout)
pParentLayout->addWidget(pWidget);
+ QtInstanceWidget::setHelpId(*pWidget, getHelpRoot() + sID);
+
#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
// Set GtkBuilder ID as accessible ID
pWidget->setAccessibleIdentifier(toQString(sID));
diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx
index e0060ebc4905..3338fcb35c73 100644
--- a/vcl/qt5/QtInstanceWidget.cxx
+++ b/vcl/qt5/QtInstanceWidget.cxx
@@ -11,6 +11,9 @@
#include <vcl/transfer.hxx>
+/** Name of QObject property used for the help ID. */
+const char* const PROPERTY_HELP_ID = "help-id";
+
QtInstanceWidget::QtInstanceWidget(QWidget* pWidget)
: m_pWidget(pWidget)
{
@@ -197,9 +200,33 @@ OUString QtInstanceWidget::get_buildable_name() const { return OUString(); }
void QtInstanceWidget::set_buildable_name(const OUString&) {}
-void QtInstanceWidget::set_help_id(const OUString&) {}
+void QtInstanceWidget::setHelpId(QWidget& rWidget, const OUString& rHelpId)
+{
+ SolarMutexGuard g;
+ GetQtInstance().RunInMainThread(
+ [&] { rWidget.setProperty(PROPERTY_HELP_ID, toQString(rHelpId)); });
+}
+
+void QtInstanceWidget::set_help_id(const OUString& rHelpId) { setHelpId(*m_pWidget, rHelpId); }
+
+OUString QtInstanceWidget::get_help_id() const
+{
+ SolarMutexGuard g;
+ QtInstance& rQtInstance = GetQtInstance();
+ if (!rQtInstance.IsMainThread())
+ {
+ OUString sHelpId;
+ rQtInstance.RunInMainThread([&] { sHelpId = get_help_id(); });
+ return sHelpId;
+ }
+
+ const QVariant aHelpIdVariant = m_pWidget->property(PROPERTY_HELP_ID);
+ if (!aHelpIdVariant.isValid())
+ return OUString();
-OUString QtInstanceWidget::get_help_id() const { return OUString(); }
+ assert(aHelpIdVariant.canConvert<QString>());
+ return toOUString(aHelpIdVariant.toString());
+}
void QtInstanceWidget::set_grid_left_attach(int) {}