fusion: Improve visibility of Checkbox in dark mode
Fixes: QTBUG-136960 Pick-to: 6.8 6.9 6.10 Change-Id: I606fd034ba83011624ff9a38a8c973659c241c26 Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
This commit is contained in:
parent
9b9511c354
commit
5618710d63
@ -591,7 +591,8 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
|
||||
if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
|
||||
painter->setPen(highlightedOutline);
|
||||
else
|
||||
painter->setPen(outline.lighter(110));
|
||||
painter->setPen(colorScheme() == Qt::ColorScheme::Dark ? outline.lighter(150)
|
||||
: outline.lighter(110));
|
||||
painter->drawRect(rect);
|
||||
|
||||
QColor checkMarkColor = option->palette.text().color().darker(120);
|
||||
@ -3558,6 +3559,11 @@ bool QFusionStyle::isHighContrast() const
|
||||
== Qt::ContrastPreference::HighContrast;
|
||||
}
|
||||
|
||||
Qt::ColorScheme QFusionStyle::colorScheme() const
|
||||
{
|
||||
return QGuiApplicationPrivate::platformTheme()->colorScheme();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qfusionstyle_p.cpp"
|
||||
|
@ -75,6 +75,7 @@ protected:
|
||||
|
||||
private:
|
||||
bool isHighContrast() const;
|
||||
Qt::ColorScheme colorScheme() const;
|
||||
};
|
||||
|
||||
#endif // style_fusion
|
||||
|
@ -70,7 +70,10 @@ public:
|
||||
}
|
||||
if (pal.window().style() == Qt::TexturePattern)
|
||||
return QColor(0, 0, 0, 160);
|
||||
return pal.window().color().darker(140);
|
||||
if (colorScheme() == Qt::ColorScheme::Dark)
|
||||
return pal.window().color().lighter(140);
|
||||
else
|
||||
return pal.window().color().darker(140);
|
||||
}
|
||||
|
||||
QColor highlightedOutline(const QPalette &pal) const {
|
||||
@ -102,6 +105,11 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
Qt::ColorScheme colorScheme() const
|
||||
{
|
||||
return QGuiApplicationPrivate::platformTheme()->colorScheme();
|
||||
}
|
||||
|
||||
bool isHighContrast() const
|
||||
{
|
||||
return QGuiApplicationPrivate::platformTheme()->contrastPreference()
|
||||
|
Loading…
x
Reference in New Issue
Block a user