From 72e9afd8d041a4816a6118452707cd44974746d1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 7 Jul 2017 15:24:20 +0200 Subject: [PATCH] Fix underline color in diff description when hovering Since e.g. whitespace can have a different foreground color than "normal" text, we have to explicitly set the color for the underline when hovering. Use foreground color if there is no specific text color set for "normal" text. Change-Id: I9825d24af0d598b039a0db9ed86966605e22ac04 Reviewed-by: Jarek Kobus --- src/plugins/diffeditor/diffeditor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp index ac47e23985..ab55a89274 100644 --- a/src/plugins/diffeditor/diffeditor.cpp +++ b/src/plugins/diffeditor/diffeditor.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -198,7 +199,9 @@ void DescriptionEditorWidget::highlightCurrentContents() QTextEdit::ExtraSelection sel; sel.cursor = m_currentCursor; sel.cursor.select(QTextCursor::LineUnderCursor); - sel.format.setFontUnderline(true); + sel.format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + const QColor textColor = TextEditorSettings::fontSettings().formatFor(C_TEXT).foreground(); + sel.format.setUnderlineColor(textColor.isValid() ? textColor : palette().color(QPalette::Foreground)); setExtraSelections(TextEditorWidget::OtherSelection, QList() << sel); } -- GitLab