patches for custom styleelements, kcapacitybar

Olivier Goffart ogoffart at kde.org
Sat Sep 27 20:15:59 BST 2008


Le samedi 27 septembre 2008, Thomas Lübking a écrit :
> ... 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)

[...]
> ==> 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?!?

I don't understand this point. Can you please elaborate?
How do you want to extent QStyle enums?

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

You really could call KStyle::customElementId in the paintEvent.




Aslo, QHash should be used instead of QMap, there are only few case where a 
QMap is better than a QHash.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080927/67182874/attachment.sig>


More information about the kde-core-devel mailing list