TextEditor: allow highlightings in selections

If the selection foregound color is undefined do not overwrite the
already applied highlighting.

Fixes: QTCREATORBUG-24656
Change-Id: Ia125e8e6b9efba73d5a13facc2446a793d59f5c3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-09-18 13:37:37 +02:00
parent 7d21caabdb
commit d99e00c49f

View File

@@ -4724,8 +4724,7 @@ void TextEditorWidgetPrivate::setupSelections(const PaintEventData &data,
const QTextCharFormat selectionFormat = data.fontSettings.toTextCharFormat(C_SELECTION); const QTextCharFormat selectionFormat = data.fontSettings.toTextCharFormat(C_SELECTION);
if (selectionFormat.background().style() != Qt::NoBrush) if (selectionFormat.background().style() != Qt::NoBrush)
o.format.setBackground(selectionFormat.background()); o.format.setBackground(selectionFormat.background());
if (selectionFormat.foreground().style() != Qt::NoBrush) o.format.setForeground(selectionFormat.foreground());
o.format.setForeground(selectionFormat.foreground());
} }
if ((data.textCursor.hasSelection() && i == data.context.selections.size() - 1) if ((data.textCursor.hasSelection() && i == data.context.selections.size() - 1)
|| (o.format.foreground().style() == Qt::NoBrush || (o.format.foreground().style() == Qt::NoBrush