From 088d5c0f779edc12605a04486d223749c3158152 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 25 Oct 2019 13:18:29 +0200 Subject: [PATCH] TextEditor: Fix HTML escaping of tool tips Tool tips without help ID were HTML escaped but never shown in a HTML tool tip. Just always make them rich text. Line endings in plain text must be changed to "
" as well. Change-Id: I9fd378e2c9a58ddf5834d67927fe3da9157cfbc7 Reviewed-by: David Schulz --- src/plugins/texteditor/basehoverhandler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index 05c9f1a52ae..d7d53ca5f0c 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -142,12 +142,15 @@ void BaseHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, Re void BaseHoverHandler::decorateToolTip() { - m_toolTip = m_toolTip.toHtmlEscaped(); + if (!m_toolTip.isEmpty()) + m_toolTip = "

" + m_toolTip.toHtmlEscaped().replace('\n', "
") + "

"; if (lastHelpItemIdentified().isValid() && !lastHelpItemIdentified().isFuzzyMatch()) { const QString &helpContents = lastHelpItemIdentified().extractContent(false); - if (!helpContents.isEmpty()) - m_toolTip = m_toolTip.isEmpty() ? helpContents : ("

" + m_toolTip + "


" + helpContents + "

"); + if (!helpContents.isEmpty()) { + m_toolTip = m_toolTip.isEmpty() ? helpContents + : (m_toolTip + "

" + helpContents + "

"); + } } }