Git commit a3b3545cabf1c52ce6c0a065dc415dc6fe97bf28 by Eike Hein. Committed on 13/02/2013 at 12:59. Pushed by hein into branch 'master'. Port sidebar delegate to KColorScheme. Certain KDE color schemes have Window Background and View Text not contrasting, which causes invisible icon labels when using QPalette::Text on QPalette::Base. An example is the default color scheme in openSUSE 12.3. Thanks to Will Stephenson for noticing. CCMAIL:wstephenson@kde.org It turns out that the Places sidebar in Dolphin suffers from the same bug, so a similar change should be done there. Frank? CCMAIL:frank78ac@googlemail.com M +14 -8 ui/sidebar.cpp http://commits.kde.org/okular/a3b3545cabf1c52ce6c0a065dc415dc6fe97bf28 diff --git a/ui/sidebar.cpp b/ui/sidebar.cpp index dbf66a9..a73779d 100644 --- a/ui/sidebar.cpp +++ b/ui/sidebar.cpp @@ -29,6 +29,7 @@ #include #include #include +#include = #include "settings.h" = @@ -107,27 +108,32 @@ void SidebarDelegate::paint( QPainter *painter, const= QStyleOptionViewItem &opti QColor foreColor; bool disabled =3D false; bool hover =3D false; + if ( !( option.state & QStyle::State_Enabled ) ) { - backBrush =3D option.palette.brush( QPalette::Disabled, QPalette::= Base ); - foreColor =3D option.palette.color( QPalette::Disabled, QPalette::= Text ); + KColorScheme colorScheme( QPalette::Disabled, KColorScheme::Window= ); + backBrush =3D colorScheme.background(); + foreColor =3D colorScheme.foreground().color(); disabled =3D true; } else if ( option.state & ( QStyle::State_HasFocus | QStyle::State_Sele= cted ) ) { - backBrush =3D option.palette.brush( QPalette::Highlight ); - foreColor =3D option.palette.color( QPalette::HighlightedText ); + KColorScheme colorScheme( option.palette.currentColorGroup(), KCol= orScheme::Selection ); + backBrush =3D colorScheme.background(); + foreColor =3D colorScheme.foreground().color(); } else if ( option.state & QStyle::State_MouseOver ) { - backBrush =3D option.palette.color( QPalette::Highlight ).light( 1= 15 ); - foreColor =3D option.palette.color( QPalette::HighlightedText ); + KColorScheme colorScheme( option.palette.currentColorGroup(), KCol= orScheme::Selection ); + backBrush =3D colorScheme.background().color().light( 115 ); + foreColor =3D colorScheme.foreground().color(); hover =3D true; } else /*if ( option.state & QStyle::State_Enabled )*/ { - backBrush =3D option.palette.brush( QPalette::Base ); - foreColor =3D option.palette.color( QPalette::Text ); + KColorScheme colorScheme( option.palette.currentColorGroup(), KCol= orScheme::Window ); + backBrush =3D colorScheme.background(); + foreColor =3D colorScheme.foreground().color(); } QStyle *style =3D QApplication::style(); QStyleOptionViewItemV4 opt( option );