patches for custom styleelements, kcapacitybar

Thomas L├╝bking thomas.luebking at
Sat Sep 27 17:32:07 BST 2008

... are attached.

this adds easy string based runtime element extension to styles. (i.e. a 
widget can ask styles to support e.g. "PE_CapacityBar" or paint a fallback)
the overhead is minimal (could be a little less in the style constructor, but 
this way, it's much easier to use)

- the oxygen part patch is a only proof of concept. the implementation isn't 
structural or too smart and only draws a red rect indicating that it works.
-> you don't really want to include that!

- focussing on painting, CT and PM are currently /NOT/ supported. the 
implementation could however be easily extended by this if it's demanded.

- invoking kstyle will make things easier for both - widget and style - but is 
not necessary (i.e. plain qt apps / styles can make use of this technique w/o 
linking kdeui at all)

==> necessary (??) bincompat tradeoffs:
- i'd rather prefer to extend the QStyle enums than defining some numbers in 
kstyle.cpp, but this would make it necessary to change the draw* 
implementations to explicitly use QStyle::PrimitiveElement etc. (otherwise 
they'd be shadowed) and i am (pfff.. still...) not sure about binary 
compatibility here - now: would this change the function signature or not?!?

- catching style changes in the widget is required.
if reimplementing "virtual QWidget::changeEvent()" is not acceptable, one 
could catch style changes right before painting (i.e. safe the pointer for the 
style that generated the element id, and "if (style() != d->oldStyle) 
regenerateId();" or add an eventfilter from a helper object)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: customelements.oxygen.diff
Type: text/x-patch
Size: 1823 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: customelements.kstyle.diff
Type: text/x-patch
Size: 5875 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: customelements.kcapacitybar.diff
Type: text/x-patch
Size: 2036 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list