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

New commits:
commit 25335198fb2c8138247225330b24865987693d2f
Author:     Rafael Lima <rafael.palma.l...@gmail.com>
AuthorDate: Fri Aug 2 19:30:18 2024 +0200
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Sat Aug 3 12:29:27 2024 +0200

    tdf#162297 Wrap tooltips in Qt5
    
    Acoording to the Qt documentation, in order to wrap the tooltip a rich-text 
style needs to be set.
    
    This patch sets a dummy style to make sure the tooltip gets wrapped in LO.
    
    Change-Id: I7e950932572030581abc1c81fb4c146cb4394eb4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171411
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit fa89130d4980662642cb81a05ec044dbe21fd5d0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171412

diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 5c860333793f..5f2a001e53c1 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -721,8 +721,13 @@ bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& 
rWidget, QEvent* pEvent)
         // Otherwise Qt will continue handling ToolTip events from the 
"parent" window.
         const QtFrame* pPopupFrame = GetQtInstance()->activePopup();
         if (!rFrame.m_aTooltipText.isEmpty() && (!pPopupFrame || pPopupFrame 
== &rFrame))
-            QToolTip::showText(QCursor::pos(), 
toQString(rFrame.m_aTooltipText), &rWidget,
-                               rFrame.m_aTooltipArea);
+        {
+            // tdf#162297 Use a dummy style to ensure the tooltip is wrapped
+            QString sTooltipText("<font font-weight=normal>");
+            sTooltipText += toQString(rFrame.m_aTooltipText);
+            sTooltipText += "</font>";
+            QToolTip::showText(QCursor::pos(), sTooltipText, &rWidget, 
rFrame.m_aTooltipArea);
+        }
         else
         {
             QToolTip::hideText();

Reply via email to