diff options
| author | Emmanuel Pescosta <[email protected]> | 2012-08-14 22:02:24 +0200 |
|---|---|---|
| committer | Emmanuel Pescosta <[email protected]> | 2012-08-14 22:02:24 +0200 |
| commit | b039392f344f4d8b0a540c542f83e418349a7d4e (patch) | |
| tree | 59ae86ad16d6cc311af065722483ccddd6e94680 /src/kitemviews/kitemlistgroupheader.cpp | |
| parent | 00935edbdead8955d7f8d0e3ef520139da3f3bec (diff) | |
Fix wrong text color in Places Group Header. Use QPalette::Window for base color and QPalette::WindowText for text color. Also changed m_roleColor color mixing to 60% (from 70%) -> Better visible color difference when base color is darker than text color. Also changed styleOption().palette.brush(group, role).color() to styleOption().palette.color(group, role) in KStandardItemListWidget -> should be more efficient.
BUG: 303133
Diffstat (limited to 'src/kitemviews/kitemlistgroupheader.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistgroupheader.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/kitemviews/kitemlistgroupheader.cpp b/src/kitemviews/kitemlistgroupheader.cpp index 576d20b88..17c95a97c 100644 --- a/src/kitemviews/kitemlistgroupheader.cpp +++ b/src/kitemviews/kitemlistgroupheader.cpp @@ -180,10 +180,10 @@ void KItemListGroupHeader::updateCache() // Calculate the role- and line-color. No alphablending is used for // performance reasons. - const QColor c1 = m_styleOption.palette.text().color(); - const QColor c2 = m_styleOption.palette.base().color(); + const QColor c1 = textColor(); + const QColor c2 = baseColor(); m_separatorColor = mixedColor(c1, c2, 10); - m_roleColor = mixedColor(c1, c2, 70); + m_roleColor = mixedColor(c1, c2, 60); const int padding = qMax(1, m_styleOption.padding); const int horizontalMargin = qMax(2, m_styleOption.horizontalMargin); @@ -211,4 +211,26 @@ QColor KItemListGroupHeader::mixedColor(const QColor& c1, const QColor& c2, int (c1.blue() * c1Percent + c2.blue() * c2Percent) / 100); } +QPalette::ColorRole KItemListGroupHeader::normalTextColorRole() const +{ + return QPalette::Text; +} + +QPalette::ColorRole KItemListGroupHeader::normalBaseColorRole() const +{ + return QPalette::Window; +} + +QColor KItemListGroupHeader::textColor() const +{ + const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive; + return styleOption().palette.color(group, normalTextColorRole()); +} + +QColor KItemListGroupHeader::baseColor() const +{ + const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive; + return styleOption().palette.color(group, normalBaseColorRole()); +} + #include "kitemlistgroupheader.moc" |
