patches for custom styleelements, kcapacitybar

Thomas Lübking thomas.luebking at web.de
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)

NOTICE:
- 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)

Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: customelements.oxygen.diff
Type: text/x-patch
Size: 1823 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080927/39b4bfd2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: customelements.kstyle.diff
Type: text/x-patch
Size: 5875 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080927/39b4bfd2/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: customelements.kcapacitybar.diff
Type: text/x-patch
Size: 2036 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080927/39b4bfd2/attachment-0002.bin>


More information about the kde-core-devel mailing list