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>
This commit is contained in:
David Schulz
2019-06-17 14:24:56 +02:00
parent b278d2a2fd
commit 09b9aa98a8

View File

@@ -106,6 +106,7 @@
#include <QScrollBar> #include <QScrollBar>
#include <QShortcut> #include <QShortcut>
#include <QStyle> #include <QStyle>
#include <QStyleFactory>
#include <QTextBlock> #include <QTextBlock>
#include <QTextCodec> #include <QTextCodec>
#include <QTextCursor> #include <QTextCursor>
@@ -5363,7 +5364,19 @@ void TextEditorWidgetPrivate::drawFoldingMarker(QPainter *painter, const QPalett
if (hovered) if (hovered)
opt.palette.setBrush(QPalette::Window, pal.highlight()); 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")) { if (!qstrcmp(className, "OxygenStyle")) {
const QStyle::PrimitiveElement direction = expanded ? QStyle::PE_IndicatorArrowDown const QStyle::PrimitiveElement direction = expanded ? QStyle::PE_IndicatorArrowDown