summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2024-08-02 19:30:18 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2024-08-03 12:29:27 +0200
commit25335198fb2c8138247225330b24865987693d2f (patch)
treed4534b4ff9e9d6c99c29ec5105f29152f9e9e958
parent5b4e4c94c45a994e7fcaf4959e12765dcaa3ab3a (diff)
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.weghorn@posteo.de> (cherry picked from commit fa89130d4980662642cb81a05ec044dbe21fd5d0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171412
-rw-r--r--vcl/qt5/QtWidget.cxx9
1 files changed, 7 insertions, 2 deletions
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();