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)
|
if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
|
||||||
painter->setPen(highlightedOutline);
|
painter->setPen(highlightedOutline);
|
||||||
else
|
else
|
||||||
painter->setPen(outline.lighter(110));
|
painter->setPen(colorScheme() == Qt::ColorScheme::Dark ? outline.lighter(150)
|
||||||
|
: outline.lighter(110));
|
||||||
painter->drawRect(rect);
|
painter->drawRect(rect);
|
||||||
|
|
||||||
QColor checkMarkColor = option->palette.text().color().darker(120);
|
QColor checkMarkColor = option->palette.text().color().darker(120);
|
||||||
@ -3558,6 +3559,11 @@ bool QFusionStyle::isHighContrast() const
|
|||||||
== Qt::ContrastPreference::HighContrast;
|
== Qt::ContrastPreference::HighContrast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Qt::ColorScheme QFusionStyle::colorScheme() const
|
||||||
|
{
|
||||||
|
return QGuiApplicationPrivate::platformTheme()->colorScheme();
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#include "moc_qfusionstyle_p.cpp"
|
#include "moc_qfusionstyle_p.cpp"
|
||||||
|
@ -75,6 +75,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool isHighContrast() const;
|
bool isHighContrast() const;
|
||||||
|
Qt::ColorScheme colorScheme() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // style_fusion
|
#endif // style_fusion
|
||||||
|
@ -70,6 +70,9 @@ public:
|
|||||||
}
|
}
|
||||||
if (pal.window().style() == Qt::TexturePattern)
|
if (pal.window().style() == Qt::TexturePattern)
|
||||||
return QColor(0, 0, 0, 160);
|
return QColor(0, 0, 0, 160);
|
||||||
|
if (colorScheme() == Qt::ColorScheme::Dark)
|
||||||
|
return pal.window().color().lighter(140);
|
||||||
|
else
|
||||||
return pal.window().color().darker(140);
|
return pal.window().color().darker(140);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +105,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Qt::ColorScheme colorScheme() const
|
||||||
|
{
|
||||||
|
return QGuiApplicationPrivate::platformTheme()->colorScheme();
|
||||||
|
}
|
||||||
|
|
||||||
bool isHighContrast() const
|
bool isHighContrast() const
|
||||||
{
|
{
|
||||||
return QGuiApplicationPrivate::platformTheme()->contrastPreference()
|
return QGuiApplicationPrivate::platformTheme()->contrastPreference()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user