extender api review round 3

Kevin Ottens ervin at kde.org
Sun Aug 3 22:02:25 CEST 2008


Le Sunday 03 August 2008, Rob Scheepmaker a écrit :
> > > class PLASMA_EXPORT Applet : public QGraphicsWidget
> > > {
> > >     public:
> > >         virtual void initExtenderItem(ExtenderItem *item);
> >
> > Again, I'd try to fit this one somewhere else. Maybe Extender?
>
> I really would like to avoid having to subclass Extender.

Agreed. That's why IIRC from the previous round I proposed a signal in 
Extender as an alternative. Not sure if that would fit perfectly.

> The only
> situation where you will have to implement this class now, is if you wish
> to change the presentation of the extenderitems from the default verticle
> layout one, to something fancier.

OK, perfect, that actually answers my ending question in my previous mail.

> > >         Extender *extender() const;
> >
> > Again, I wouldn't keep this one.
> >
> > The idea here being that Extender is kind of an add-on decorator to
> > Applet, so to make that clear API wise we should really avoid any
> > Applet->Extender dependency in the public API.
>
> Well, will need this anyway in private implementation,

Implementation detail IMHO. :-)

> so even when the
> extender is somewhere outside of the applet (say in the topleft quadrant as
> part of a popup), you can add items to the extender by just dropping them
> on the applet. And actually, an applet will also always need to keep a
> pointer around to do stuff with their extender so while not entirely
> necesarry, I don't think this really is api bloat.

It's not API bloat, it just gives the wrong message for someone who get to the 
API for the first time. If it's a decorator it's optional, this kind of 
accessor gives the feeling Applets always get an Extender.

> No, in normal cases you'll never need to subclass extender. You'll just
> instantiate an extender, and add extenderitems to it... extender takes care
> of the layouting and bookkeeping of these items. Only when you'd like to do
> different layouting you'll need to implement a new extender.

Perfect.

Regards.
-- 
Kévin 'ervin' Ottens, http://ervin.ipsquad.net
"Ni le maître sans disciple, Ni le disciple sans maître,
Ne font reculer l'ignorance."


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080803/239fb3c2/attachment-0001.pgp 


More information about the Plasma-devel mailing list