mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
KItemListWidget: make unfocused alternate background slightly lighter
This commit is contained in:
parent
4d018e1c3c
commit
7a6cba7f51
|
@ -105,7 +105,17 @@ void KItemListWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
|
||||||
Q_UNUSED(option)
|
Q_UNUSED(option)
|
||||||
|
|
||||||
if (m_alternateBackground) {
|
if (m_alternateBackground) {
|
||||||
const QColor backgroundColor = m_styleOption.palette.color(QPalette::AlternateBase);
|
QColor backgroundColor = m_styleOption.palette.color(QPalette::AlternateBase);
|
||||||
|
if (!widget->hasFocus()) {
|
||||||
|
QColor baseColor = m_styleOption.palette.color(QPalette::Base);
|
||||||
|
if (baseColor.lightnessF() > 0.5) {
|
||||||
|
// theme seems light
|
||||||
|
backgroundColor = backgroundColor.lighter(101);
|
||||||
|
} else {
|
||||||
|
// theme seems dark
|
||||||
|
backgroundColor = backgroundColor.darker(101);
|
||||||
|
}
|
||||||
|
}
|
||||||
const QRectF backgroundRect(0, 0, size().width(), size().height());
|
const QRectF backgroundRect(0, 0, size().width(), size().height());
|
||||||
painter->fillRect(backgroundRect, backgroundColor);
|
painter->fillRect(backgroundRect, backgroundColor);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue