Browse Source

qt: Fix richtext detection hang issue on very old Qt versions

Alternative implementation. Thanks to @awoland for the original.
Fixes #3486.

Rebased-from: 90a28680bd8b24800428b301f7bf6cbf534de2ca 0.8.x
0.8
Wladimir J. van der Laan 11 years ago committed by Warren Togami
parent
commit
56646670e1
  1. 6
      src/qt/guiutil.cpp

6
src/qt/guiutil.cpp

@ -290,11 +290,11 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
{ {
QWidget *widget = static_cast<QWidget*>(obj); QWidget *widget = static_cast<QWidget*>(obj);
QString tooltip = widget->toolTip(); QString tooltip = widget->toolTip();
if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt/>") && !Qt::mightBeRichText(tooltip)) if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt") && !Qt::mightBeRichText(tooltip))
{ {
// Prefix <qt/> to make sure Qt detects this as rich text // Envelop with <qt></qt> to make sure Qt detects this as rich text
// Escape the current message as HTML and replace \n by <br> // Escape the current message as HTML and replace \n by <br>
tooltip = "<qt/>" + HtmlEscape(tooltip, true); tooltip = "<qt>" + HtmlEscape(tooltip, true) + "</qt>";
widget->setToolTip(tooltip); widget->setToolTip(tooltip);
return true; return true;
} }

Loading…
Cancel
Save