1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-07-07 10:51:45 +00:00

KItemListWidget: make unfocused alternate background slightly lighter

This commit is contained in:
Méven Car 2023-09-06 10:40:22 +02:00 committed by Méven Car
parent 4d018e1c3c
commit 7a6cba7f51

View File

@ -105,7 +105,17 @@ void KItemListWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
Q_UNUSED(option)
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());
painter->fillRect(backgroundRect, backgroundColor);
}