diff options
author | David Schulz <david.schulz@qt.io> | 2019-06-17 14:24:56 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2019-06-18 11:45:26 +0000 |
commit | 09b9aa98a8a1ddb2e058def737a3a3ec565f827d (patch) | |
tree | 383815d417f12f3ecfd869d39a925a42c3f77cdd /src/plugins/texteditor/texteditor.cpp | |
parent | b278d2a2fdf4c528cc290aebb7d9c5d3e5cd780a (diff) | |
download | qt-creator-09b9aa98a8a1ddb2e058def737a3a3ec565f827d.tar.gz |
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 <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/texteditor/texteditor.cpp')
-rw-r--r-- | src/plugins/texteditor/texteditor.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 197eb5ddcf..2250b6fb5b 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -106,6 +106,7 @@ #include <QScrollBar> #include <QShortcut> #include <QStyle> +#include <QStyleFactory> #include <QTextBlock> #include <QTextCodec> #include <QTextCursor> @@ -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<QStyle> 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 |