aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2020-10-20 10:16:33 +0200
committerDavid Schulz <david.schulz@qt.io>2020-10-21 04:32:27 +0000
commit0ca9ea353c91b9715e1dc9e8533560f94f261e23 (patch)
tree46a2a5e853bf478374ed75dfd51918c40e9901e0
parent6b8d8e414ac45ed74fd3968da9525c704178eae8 (diff)
Editor: Do not use disabled code color for right margin highlight
Fixes: QTCREATORBUG-17174 Change-Id: I68729d5a44b23fe46b810054a1dc472ffd63e272 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/texteditor/texteditor.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index ec634b0e85..6bd05f9b2c 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -4175,6 +4175,13 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
q->viewport()->update(updateRect);
}
+QColor blendRightMarginColor(const FontSettings &settings, bool areaColor)
+{
+ const QColor baseColor = settings.toTextCharFormat(C_TEXT).background().color();
+ const QColor col = (baseColor.value() > 128) ? Qt::black : Qt::white;
+ return blendColors(baseColor, col, areaColor ? 16 : 32);
+}
+
void TextEditorWidgetPrivate::paintRightMarginArea(PaintEventData &data, QPainter &painter) const
{
if (m_visibleWrapColumn <= 0)
@@ -4189,7 +4196,7 @@ void TextEditorWidgetPrivate::paintRightMarginArea(PaintEventData &data, QPainte
data.eventRect.top(),
data.viewportRect.width() - data.rightMargin,
data.eventRect.height());
- painter.fillRect(behindMargin, data.ifdefedOutFormat.background());
+ painter.fillRect(behindMargin, blendRightMarginColor(m_document->fontSettings(), true));
}
}
@@ -4199,11 +4206,8 @@ void TextEditorWidgetPrivate::paintRightMarginLine(const PaintEventData &data,
if (m_visibleWrapColumn <= 0 || data.rightMargin >= data.viewportRect.width())
return;
- const QBrush background = data.ifdefedOutFormat.background();
- const QColor baseColor = m_document->fontSettings().toTextCharFormat(C_TEXT).background().color();
- const QColor col = (baseColor.value() > 128) ? Qt::black : Qt::white;
const QPen pen = painter.pen();
- painter.setPen(blendColors(background.isOpaque() ? background.color() : baseColor, col, 32));
+ painter.setPen(blendRightMarginColor(m_document->fontSettings(), false));
painter.drawLine(QPointF(data.rightMargin, data.eventRect.top()),
QPointF(data.rightMargin, data.eventRect.bottom()));
painter.setPen(pen);