How to adjust applet size according to its child QGraphicsWidget?

Alexis Ménard menard at kde.org
Wed Feb 25 12:33:25 CET 2009


Ok,

I found the problem. Nowhere you set the size of MyGraphicsWidget, so the
layout can't know about its size, and more you never set the preferredSize
so it use the default which is arbitrary small. Take a look on the doc for
setPreferredSize, setMinimumSize, setMaximumSize and the overload of
sizeHint for custom sizeHints.

Btw :

QSizeF s = parentWidget()->size()

That is not a good approach in the paint event.

2009/2/25 Petri Damstén <petri.damsten at gmail.com>

> On Wednesday 25 February 2009 12:05:52 Dong Tiger wrote:
> > 2008/12/30 Alexis Ménard <menard at kde.org>
> >
> > > Unfortunately you can't it is a bug in Qt.
> > >
> > > You can take a look to the task tracker of Qt Number 231114 and 211500.
> I
> > > guess it is what you try to solve. The fix is in 4.4 branch (so
> scheduled
> > > for 4.4.4) and in 4.5.
> >
> > I still can't get this work even with latest Qt4.5. I've attached code of
> a
> > sample plasmoid which demonstrate the problem. You are welcomed to try it
> > out. Right click on the applet to modify its child widget size.
> >
> > > As a workaround you have to manage the resize of your applet by hand
> when
> > > the size of the layout change.
> >
> > The question is how can I do it? When the embedded QGraphicsWidget need
> to
> > enlarge, say from 200x200 to 400x400, how can I decide what the applet
> size
> > should be?
>
> Does this work?
>
> Petri
>
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20090225/a89ec954/attachment.htm 


More information about the Plasma-devel mailing list