TextEditor: fix underlined text Bg color

Set default bg color to NoBrush.
Previously caused incorrect painting when
underline style was set without background.

Task-number: QTCREATORBUG-18101
Change-Id: I4c1d86a3c711a3962e01ccf3a937dafa36b68ec2
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Ivan Donchevskii
2017-05-16 13:02:47 +02:00
parent 4f8ec92c80
commit 8679d8e9a9

View File

@@ -174,6 +174,11 @@ QTextCharFormat FontSettings::toTextCharFormat(TextStyle category) const
tf.setForeground(f.foreground());
if (f.background().isValid() && (category == C_TEXT || f.background() != m_scheme.formatFor(C_TEXT).background()))
tf.setBackground(f.background());
// underline does not need to fill without having background color
if (f.underlineStyle() != QTextCharFormat::NoUnderline && !f.background().isValid())
tf.setBackground(QBrush(Qt::BrushStyle::NoBrush));
tf.setFontWeight(f.bold() ? QFont::Bold : QFont::Normal);
tf.setFontItalic(f.italic());