vcl/qt5/QtInstanceToolbar.cxx |   34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

New commits:
commit c9b32d6ac289c452f345d04a0a77f946001c14e5
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri Feb 6 00:37:09 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Feb 6 10:15:03 2026 +0100

    tdf#130857 qt weld: Implement QtInstanceToolbar::{g,s}et_item_tooltip_text
    
    In a WIP branch where support for using native
    Qt widgets is declared for sidebar elements, this
    e.g. makes the tooltips show up when hovering over
    the buttons at the top of the "Styles" sidebar
    deck in Writer (e.g. "Paragraph Styles", "Character
    Styles").
    
    (Sidebar not supported yet with native Qt widgets, but
    this is one step in that direction at least.)
    
    Change-Id: I9d2d894b42caa5c8fd103dabb81041c60d39628c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198801
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceToolbar.cxx b/vcl/qt5/QtInstanceToolbar.cxx
index 15af521dcff2..5a62f87f4998 100644
--- a/vcl/qt5/QtInstanceToolbar.cxx
+++ b/vcl/qt5/QtInstanceToolbar.cxx
@@ -127,15 +127,29 @@ OUString QtInstanceToolbar::get_item_label(const 
OUString&) const
     return OUString();
 }
 
-void QtInstanceToolbar::set_item_tooltip_text(const OUString&, const OUString&)
+void QtInstanceToolbar::set_item_tooltip_text(const OUString& rIdent, const 
OUString& rTip)
 {
-    assert(false && "Not implemented yet");
+    SolarMutexGuard g;
+
+    GetQtInstance().RunInMainThread([&] {
+        QToolButton* pToolButton = 
m_pToolBar->findChild<QToolButton*>(toQString(rIdent));
+        assert(pToolButton && "No tool button with the given ID found");
+        pToolButton->setToolTip(toQString(rTip));
+    });
 }
 
-OUString QtInstanceToolbar::get_item_tooltip_text(const OUString&) const
+OUString QtInstanceToolbar::get_item_tooltip_text(const OUString& rIdent) const
 {
-    assert(false && "Not implemented yet");
-    return OUString();
+    SolarMutexGuard g;
+
+    OUString sToolTip;
+    GetQtInstance().RunInMainThread([&] {
+        QToolButton* pToolButton = 
m_pToolBar->findChild<QToolButton*>(toQString(rIdent));
+        assert(pToolButton && "No tool button with the given ID found");
+        sToolTip = toOUString(pToolButton->toolTip());
+    });
+
+    return sToolTip;
 }
 
 void QtInstanceToolbar::set_item_icon_name(const OUString& rIdent, const 
OUString& rIconName)
commit 93ea856ceafe5463e5c33e625e888ad9648ce501
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri Feb 6 00:25:27 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Feb 6 10:14:55 2026 +0100

    tdf#130857 qt weld: Implement QtInstanceToolbar::set_item_icon_name
    
    This is used e.g. to set the icons for the buttons
    at the top of the "Styles" sidebar deck in
    Writer.
    
    (Sidebar not supported yet with native Qt widgets, but
    this is one step in that direction at least.)
    
    Change-Id: Ib178670beda8a4049317160cd10469b762fb5ca1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198798
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceToolbar.cxx b/vcl/qt5/QtInstanceToolbar.cxx
index 53dda649742b..15af521dcff2 100644
--- a/vcl/qt5/QtInstanceToolbar.cxx
+++ b/vcl/qt5/QtInstanceToolbar.cxx
@@ -138,9 +138,15 @@ OUString QtInstanceToolbar::get_item_tooltip_text(const 
OUString&) const
     return OUString();
 }
 
-void QtInstanceToolbar::set_item_icon_name(const OUString&, const OUString&)
+void QtInstanceToolbar::set_item_icon_name(const OUString& rIdent, const 
OUString& rIconName)
 {
-    assert(false && "Not implemented yet");
+    SolarMutexGuard g;
+
+    GetQtInstance().RunInMainThread([&] {
+        QToolButton* pToolButton = 
m_pToolBar->findChild<QToolButton*>(toQString(rIdent));
+        assert(pToolButton && "No tool button with the given ID found");
+        pToolButton->setIcon(loadQPixmapIcon(rIconName));
+    });
 }
 
 void QtInstanceToolbar::set_item_image_mirrored(const OUString&, bool)

Reply via email to