Color issues on KMultiTabBarTab, KUrl(Navigator)Button and KCapacityBar

Thomas Lübking thomas.luebking at web.de
Sat Aug 30 15:41:14 BST 2008


My Code copy is 2 days old, if any of this has meanwhile been fixed, sorry.

The core issue on the first to widgets is the strong assumption that 
QPalette::ButtonText contrasts with QPalette::Window.
For KUrl(Navigator)Button and KCapacityBar, also see the mail on "Styled 
custom widgets"

KMultiTabBarTab
--------------------------
problem:
calls the style to paint the background (PE_PanelButtonTool) but hardcodes the 
textcolor
style()->drawItemText(&painter, labelPaintArea, Qt::AlignLeading | 
Qt::AlignVCenter, palette(), true, t, QPalette::ButtonText);

solution:
use foregroundRole() - will be QPalette::WindowText for many styles - insted 
of QPalette::ButtonText or call the style to paint the text 
(CE_ToolButtonLabel)

=========================

KUrl(Navigator)Button
-----------------------------
problem:
the widget draws no background unless hover (including autoFillBackground() 
not being set), but KUrlButton::foregroundColor() returns the widgets 
foregroundRole color (as it inherits QPushbutton, usually 
QPalette::ButtonText) what fails on Qt4's transparent widgets

solution:
vv. to above, hardcode QPalette::WindowText as unhovered role or ensure the bg 
is covered with QPalette::Button

===================

KCapacityBar
-----------------
problem(s):
1) the widget uses QPalette::HighlightedText to create the gloss, i.e. assumes 
QPalette::HighlightedText is either Qt::white or at least very bright - 
otherwise the result (e.g. QPalette::HighlightedText == Qt::black) looks 
err... interesting.
2) the gloss turns that bright in the upper region that the text will be 
unreadable as long as QPalett::WindowText isn't dark (i.e. Qt:black)
3) the text can also become unreadable if the assumption QPalette::Highlight 
contrasts QPalette::WindowText does NOT hold (e.g. dark blue and dark grey, 
black and black etc.)

solution:
use the style and/or:
1) use Qt::white to form the gloss
2) + 3) brighten the lower part and hardcode the fontcolor to Qt::white

Regards,
Thomas




More information about the kde-core-devel mailing list