From 09b9aa98a8a1ddb2e058def737a3a3ec565f827d Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 17 Jun 2019 14:24:56 +0200 Subject: [PATCH] TextEditor: fix low contrast of hovered folding markers When using the 'windowsvista' style the folding markers are blue when hovered. This color is almost invisible on the default folding range background color. Use the tested folding markers of the fusion style, because it is already used when device pixel ratio != 1.0 Change-Id: I23659cce71a2eb101692597a1d256d43f6426920 Fixes: QTCREATORBUG-21702 Reviewed-by: Eike Ziller Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditor.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 197eb5ddcf1..2250b6fb5b2 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -106,6 +106,7 @@ #include #include #include +#include #include #include #include @@ -5363,7 +5364,19 @@ void TextEditorWidgetPrivate::drawFoldingMarker(QPainter *painter, const QPalett if (hovered) opt.palette.setBrush(QPalette::Window, pal.highlight()); - const char* const className = s->metaObject()->className(); + const char *className = s->metaObject()->className(); + + // Do not use the windows folding marker since we cannot style them and the default hover color + // is a blue which does not guarantee an high contrast on all themes. + static QPointer fusionStyleOverwrite = nullptr; + if (!qstrcmp(className, "QWindowsVistaStyle")) { + if (fusionStyleOverwrite.isNull()) + fusionStyleOverwrite = QStyleFactory::create("fusion"); + if (!fusionStyleOverwrite.isNull()) { + s = fusionStyleOverwrite.data(); + className = s->metaObject()->className(); + } + } if (!qstrcmp(className, "OxygenStyle")) { const QStyle::PrimitiveElement direction = expanded ? QStyle::PE_IndicatorArrowDown