vcl/qt5/QtInstanceButton.cxx |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

New commits:
commit 6dc8bc3a7bbcd0327c6aabf5cc5afdb0d9efb9a3
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jan 14 17:48:43 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jan 15 13:35:08 2025 +0100

    tdf#130857 qt weld: Convert accelerator in button label
    
    Otherwise e.g. the "~Open" label (STR_OPEN, which
    gets set in SfxTemplateManagerDlg::SfxTemplateManagerDlg)
    gets shown as a literal "~Open", rather than "Open" with
    the "O" being the accelerator key in a WIP branch experimenting
    with Qt welding of the "File" -> "Templates" -> "Manage Templates"
    dialog.
    
    While at it, simplify the method a bit to just
    run the single method in the main thread
    unconditionally.
    
    Change-Id: Iea25948f77edb6e884bad96cb36ab7eec67a141e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180253
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceButton.cxx b/vcl/qt5/QtInstanceButton.cxx
index 77cd14cc1d16..b41cf4528ede 100644
--- a/vcl/qt5/QtInstanceButton.cxx
+++ b/vcl/qt5/QtInstanceButton.cxx
@@ -28,15 +28,8 @@ QtInstanceButton::QtInstanceButton(QAbstractButton* pButton)
 void QtInstanceButton::set_label(const OUString& rText)
 {
     SolarMutexGuard g;
-    QtInstance& rQtInstance = GetQtInstance();
-    if (!rQtInstance.IsMainThread())
-    {
-        rQtInstance.RunInMainThread([&] { set_label(rText); });
-        return;
-    }
-
-    assert(m_pButton);
-    m_pButton->setText(toQString(rText));
+    GetQtInstance().RunInMainThread(
+        [&] { m_pButton->setText(vclToQtStringWithAccelerator(rText)); });
 }
 
 void QtInstanceButton::set_image(VirtualDevice* pDevice)

Reply via email to