summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2023-06-01 14:11:45 +0200
committerAxel Spoerl <axel.spoerl@qt.io>2023-06-04 13:51:54 +0000
commit8a9e3c78694f85582c53c66fd7dbdc7e0e5f4ab3 (patch)
tree3f9a58cef522d455ffb339449e752f7c6e6748c8
parent54d8d8055edafcd571fe190eb6077d14a6ff8ce1 (diff)
Default to WindowText color in QTextDocumentLayoutPrivate::drawBlock()
When a block is drawn in a text document, drawBlock is checking, whether the block has a BackgroundBrush property defined. If none is defined, the color used to draw lines around the block defaults to QPalette::Dark. This was implemented, assuming a light color scheme. In a dark color scheme, the lines become hardly or even not visible. This patch changes the default to Inactive/WindowText of the underlying QPalette. This provides contrast to the document's text content and is dark/light sensitive. Fixes: QTBUG-113990 Pick-to: 6.5 Change-Id: Ie855852f441a0efb11c318c7edb27395151cbcce Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 56ce6861f1..fe049766ab 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -2070,7 +2070,7 @@ void QTextDocumentLayoutPrivate::drawBlock(const QPointF &offset, QPainter *pain
const qreal width = blockFormat.lengthProperty(QTextFormat::BlockTrailingHorizontalRulerWidth).value(r.width());
const auto color = blockFormat.hasProperty(QTextFormat::BackgroundBrush)
? qvariant_cast<QBrush>(blockFormat.property(QTextFormat::BackgroundBrush)).color()
- : context.palette.color(QPalette::Dark);
+ : context.palette.color(QPalette::Inactive, QPalette::WindowText);
painter->setPen(color);
qreal y = r.bottom();
if (bl.length() == 1)