From 7425d00427ea62f7b654b873dc61a1f20204cac4 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 27 Jun 2019 11:32:29 +0200 Subject: [PATCH] Escape tooltip text The tooltip text may contain characters that need to be escaped without 'Qt::mightBeRichText' categorizing this as rich text. This is needed e.g. to show the proper type when hovering over a variable of type 'std::vector' (or some smart pointer) in edit view (no debugging session). Otherwise, just "std::vector" is shown since 'Qt::mightBeRichText' returns false for that string and "" is then probably just ignored as an invalid tag when the tooltip is displayed. Change-Id: I25ded2b21e4350a1036ab4b3d8f144383aee776d Reviewed-by: David Schulz Reviewed-by: hjk --- src/plugins/texteditor/basehoverhandler.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index dfe390d68fa..136fa30e769 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -142,15 +142,12 @@ void BaseHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, Re void BaseHoverHandler::decorateToolTip() { - if (Qt::mightBeRichText(toolTip())) - setToolTip(toolTip().toHtmlEscaped()); + m_toolTip = m_toolTip.toHtmlEscaped(); if (lastHelpItemIdentified().isValid() && !lastHelpItemIdentified().isFuzzyMatch()) { const QString &helpContents = lastHelpItemIdentified().extractContent(false); - if (!helpContents.isEmpty()) { - m_toolTip = toolTip().toHtmlEscaped(); + if (!helpContents.isEmpty()) m_toolTip = m_toolTip.isEmpty() ? helpContents : ("

" + m_toolTip + "


" + helpContents + "

"); - } } }