From kde-panel-devel Wed Feb 25 11:33:25 2009 From: =?ISO-8859-1?Q?Alexis_M=E9nard?= Date: Wed, 25 Feb 2009 11:33:25 +0000 To: kde-panel-devel Subject: Re: How to adjust applet size according to its child QGraphicsWidget? Message-Id: <81941aea0902250333p62d5f133wf3663602d8ed8312 () mail ! gmail ! com> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=123556165527106 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============1022803816==" --===============1022803816== Content-Type: multipart/alternative; boundary=001636c5b9ce98c1c20463bc9a06 --001636c5b9ce98c1c20463bc9a06 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 =3D parentWidget()->size() That is not a good approach in the paint event. 2009/2/25 Petri Damst=E9n > On Wednesday 25 February 2009 12:05:52 Dong Tiger wrote: > > 2008/12/30 Alexis M=E9nard > > > > > Unfortunately you can't it is a bug in Qt. > > > > > > You can take a look to the task tracker of Qt Number 231114 and 21150= 0. > 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@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > > --001636c5b9ce98c1c20463bc9a06 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Ok,

I found the problem. Nowhere you set the size of MyGraphicsWidge= t, 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 o= n the doc for setPreferredSize, setMinimumSize, setMaximumSize and the over= load of sizeHint for custom sizeHints.

Btw :

QSizeF s =3D parentWidget()->size()

That is not = a good approach in the paint event.

2009/= 2/25 Petri Damst=E9n <petri.damsten@gmail.com>
On Wednesday 25 February 2009 12:05:52 Dong Tiger wrote:
> 2008/12/30 Alexis M=E9nard <menar= d@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 2= 11500. I
> > guess it is what you try to solve. The fix is in 4.4 branch (so s= cheduled
> > for 4.4.4) and in 4.5.
>
> I still can't get this work even with latest Qt4.5. I've attac= hed 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 h= and when
> > the size of the layout change.
>
> The question is how can I do it? When the embedded QGraphicsWidget nee= d 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@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


--001636c5b9ce98c1c20463bc9a06-- --===============1022803816== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============1022803816==--