[Panel-devel] Finishing up the Layout Stuff

Matias Valdenegro T. mvaldenegro at informatica.utem.cl
Thu Jun 21 05:56:26 CEST 2007


El Mié 20 Jun 2007, Aaron J. Seigo escribió:
> On Wednesday 20 June 2007, Matias Valdenegro T. wrote:
> > The actual proposal is just make ALL widgets inherit Plasma::Widget and
> > create glue/wrapper code for the elements already provided by Qt (SVG,
> > Text, etc)
>
> correct me if i'm wrong, but i thought we had decided to have all widget
> inherit Plasma::LayoutItem directly?

Actually i don't remember :)

> this solves the problem of multiply inheriting GraphicsItem, which would be
> problematic for things such as QGraphicsTextItem, and keeps the hierarchy
> simple.

Ok.

> we can use the parent/child relationships that already exist in
> QGraphicsScene betwen QGraphicsItems.

Yep, i don't know how i didn't think about that in the first place.

> the difference in API that i see right now between LayoutItem and Widget is
> that widget adds geometry, setGeometry, updateGeometry, invalidate (ugly
> name, btw =) and resize.
>
> invalidate can easily go away and the rest could be moved up into
> LayoutItem .
>
> the additional parent/child relationships seem to duplicate what is already
> there in QGraphicsScene really.
>
> i'd like to see us keep it simple and move with LayoutItem if at all
> possible.

Sounds great, the only issue is i need to have a pointer to the associated 
QGraphicsItem inside LayoutItem, to call the appropiate update() functions, 
and i thought to add the following API to LayoutItem :

d-Pointer : QGraphicsItem *item; (The item to manage and it's children)
protected:
	void setItem(QGraphicsItem *item);

So, on your widget, you inherit LayoutItem and QGraphicsItem (Directly or 
indirectly) and call setItem(this), so i have a pointer to the item.


More information about the Panel-devel mailing list