Api changes: PanelSvg inheritance

Marco Martin notmart at gmail.com
Thu Apr 17 13:30:17 CEST 2008


Hi all,
I have more or less finished the api changes on Svg and PanelSvg, the two 
things that still needs to be done are
SvgPanel(path,parent) -> SvgPanel(parent) that doesn't seems to make much 
sense (having to set the file after creating the svg seems a little bit 
annoying and if it goes from here should go also from Svg)

but the thing that concerns me more is making PanelSvg to inherit from Svg
at the moment in svg it does that but it still uses an internal svg to paint 
(attached a patch that uses inheritance hope correctly).
i will try to explain my issues with that and why i would still mantain it a 
qobject, wish i could be present the last day, sigh :(

when i did the very first version of svgpanel it was indeed a subclass of svg, 
but i changed that because it seemed clumsy to me, because it would inherit 
things that are totally useless to panelsvg api like elementsize() or 
containsmultipleimages()
and it would have many paint functions with a very different behaviour:
for instance
paint(QPainter* painter, const QRectF& rect,
          const QString& elementID = QString());
will paint only an element or the complete svg, scaled in the "ugly way"
and
void paint(QPainter* painter, const QRectF& rect, const QPointF& pos);
will paint with the right composition of borders, i think it's really 
confusing
the worst part it's the clashing of the repaintNeeded signals from Svg and 
PanelSvg that have a slightly different purpose (resize of the svg vs resize 
of the panel without resizing the svg) and the only way to avoid a good stack 
overflow would be to rename the signal in panelsvg, so we would end up having 
a repaintNeeded() and a panelRepaintNeeded() that are similar-but-not-so-much
again uugly.

Cheers,
Marco Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panelsvg_inherit.diff
Type: text/x-diff
Size: 10467 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080417/2ed7e824/attachment.bin 


More information about the Panel-devel mailing list