[Panel-devel] KDE/kdebase/workspace/plasma/applets/devicenotifier

Aaron J. Seigo aseigo at kde.org
Sun Nov 4 20:55:43 CET 2007


On Sunday 04 November 2007, Alexis Ménard wrote:
> test")); +    m_label->setPen(QPen(Qt::white));

as an FYI ... i added color scheme support to Plasma::Theme yesterday. one can 
get the config object to use with KColorScheme and KStatefulBrush now from 
the theme with:

	Plasma::Theme::self()->colors();

so instead of using white for the text here, one should do like this:

m_label->setPen(KStatefulBrush(KColorScheme::Window,
				KColorScheme::NormalText,
				Theme::self()->colors())
			.brush(QPalette::Normal).color())

and you'll get the correct color for the theme (in the default case, that's 
white =).

what i'm not happy about is how rediculously verbox KStateBrush is just to get 
the color. i'm thinking that we should probably add some convenience methods 
for the common colors, such as text, background, etc. that wrap the above 
code ... 

so it would become:

m_label->setPen(Theme::self()->textColor());

and textColor would be:

QColor Theme::textColor()
{
	return KStatefulBrush(KColorScheme::Window,
			KColorScheme::NormalText, colors())
			.brush(QPalette::Normal).color();
}

for less commonly used colours one can always go back to the KStatefulBrush 
API directly.

thoughts? suggestions as to which convenience methods besides text would be 
most useful to those of you working on applets?

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20071104/1e95c941/attachment.pgp 


More information about the Panel-devel mailing list