| 469 | } |
| 470 | |
| 471 | bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt) |
| 472 | { |
| 473 | if(evt->type() == QEvent::ToolTipChange) |
| 474 | { |
| 475 | QWidget *widget = static_cast<QWidget*>(obj); |
| 476 | QString tooltip = widget->toolTip(); |
| 477 | if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt") && !Qt::mightBeRichText(tooltip)) |
| 478 | { |
| 479 | // Envelop with <qt></qt> to make sure Qt detects this as rich text |
| 480 | // Escape the current message as HTML and replace \n by <br> |
| 481 | tooltip = "<qt>" + HtmlEscape(tooltip, true) + "</qt>"; |
| 482 | widget->setToolTip(tooltip); |
| 483 | return true; |
| 484 | } |
| 485 | } |
| 486 | return QObject::eventFilter(obj, evt); |
| 487 | } |
| 488 | |
| 489 | LabelOutOfFocusEventFilter::LabelOutOfFocusEventFilter(QObject* parent) |
| 490 | : QObject(parent) |
nothing calls this directly
no test coverage detected