The art of setting text to KStatusNotifierItem

Thomas L├╝bking thomas.luebking at
Wed Jun 2 13:29:45 BST 2010

Am Wednesday 02 June 2010 schrieb Andriy Rysin:
> Got a little problem with this bug

> 1. Allow setting text to KStatusNotifierItem (and let it deal with picking

> 2. Drawing text halo, e.g black text with white halo - I tried quickly and
> could not find with a quick and reliable way to get the nice text: if you

> 3. "Cheat" by finding out (somehow) how to get the systray background and
> just set the text color to be "opposite"

> I am leaning towards 3 if there's not-so-ugly way to get systray
1 & 3 may fail if the background is translucent / transparent and you face 
some random wallpaper (which could alter pixel values on a high frequency -> 
no color would be entirely "correct")

> background, but I would also consider 2 if somebody can point me to
> reliable algorithm that provides nice text drawing on random background
> (including gradients) without knowing the font face and size.
how do you paint text w/o knowing font face & size?

However, you would just render the text with the halo color into a "big 
enough" QImage (demanded size, check QFontMetrics, + blur radius padding), 
apply some blur fliter, maybe stregth the output (for gaussian) by overlaying 
it by itself with 66% opacity, paint your final text (black) on it and convert 
the result to a pixmap.

You'll get a nice halo and it should work across all backgrounds... (and oc 
put this solution into KStatusNotifierItem if this helps elsewhere)


More information about the kde-core-devel mailing list