[Panel-devel] Plasma::Widget subclassing and QGVItem's

Matias Valdenegro T. mvaldenegro at informatica.utem.cl
Fri May 25 01:01:28 BST 2007


El Jue 24 May 2007, Andreas Aardal Hanssen escribió:
> On Wednesday 23 May 2007 18:25, Aaron J. Seigo wrote:
> > > > On Tuesday 22 May 2007, Matias Valdenegro T. wrote:
> > > > well, we could wrap Qt's ones. what this would mean probably is:
> > > > making Widget not subclass QGraphicsItem or that matter
> > > > DataVisualization. it would then become, essentially, an interface
> > > > class for "extra" plasma features. so:
> > > > namespace Plasma
> > > > {
> > > > class Label : public QGraphicsItem, public Widget
> > > > {
> > > >      // implementation of Widget API
> > > > };
> > > > }
> > > > how does that sound?
> > >
> > > Sounds nice, but widget should at least inherit LayoutItem to be
> > > layout-manageable.
> >
> > well, yes. i thought was implied =)
>
> So, maybe Widget is a Layoutitem? Maybe inheriting from QGraphicsItem and
> LayoutItem will make the item a widget?

a Widget is a LayoutItem, but i don't know if inheriting from QGraphicsItem 
will make the Qt provided items (QGraphicsTextItem and such) wrappable.

> class Widget : public QGraphicsItem, public LayoutItem
> {
> };

As we speak is defined as 

class Widget : public QGraphicsItem, public LayoutItem, public 
DataVisualization
{
};

> Just a thought. The approach we're looking at in Qt is that layouts are
> items as well, so the layout hierarchy is the same as the item hierarchy
> (as opposed to with QWidget, where the hierarchy is separate).

Yep, i've implemented the same idea, a Layout is also a LayoutItem.




More information about the kde-core-devel mailing list