[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: How to adjust applet size according to its child QGraphicsWidget?
From:       Alexis_Ménard <menard () kde ! org>
Date:       2009-02-25 11:33:25
Message-ID: 81941aea0902250333p62d5f133wf3663602d8ed8312 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@gmail.com>

> On Wednesday 25 February 2009 12:05:52 Dong Tiger wrote:
> > 2008/12/30 Alexis Ménard <menard@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@kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
>

[Attachment #5 (text/html)]

Ok,<br><br>I found the problem. Nowhere you set the size of MyGraphicsWidget, so the \
layout can&#39;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.<br> <br>Btw :<br><br>QSizeF s = \
parentWidget()-&gt;size()<br><br>That is not a good approach in the paint \
event.<br><br><div class="gmail_quote">2009/2/25 Petri Damstén <span dir="ltr">&lt;<a \
href="mailto:petri.damsten@gmail.com">petri.damsten@gmail.com</a>&gt;</span><br> \
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Wednesday 25 \
February 2009 12:05:52 Dong Tiger wrote:<br> &gt; 2008/12/30 Alexis Ménard &lt;<a \
href="mailto:menard@kde.org">menard@kde.org</a>&gt;<br> &gt;<br>
&gt; &gt; Unfortunately you can&#39;t it is a bug in Qt.<br>
&gt; &gt;<br>
&gt; &gt; You can take a look to the task tracker of Qt Number 231114 and 211500. \
I<br> &gt; &gt; guess it is what you try to solve. The fix is in 4.4 branch (so \
scheduled<br> &gt; &gt; for 4.4.4) and in 4.5.<br>
&gt;<br>
&gt; I still can&#39;t get this work even with latest Qt4.5. I&#39;ve attached code \
of a<br> &gt; sample plasmoid which demonstrate the problem. You are welcomed to try \
it<br> &gt; out. Right click on the applet to modify its child widget size.<br>
&gt;<br>
&gt; &gt; As a workaround you have to manage the resize of your applet by hand \
when<br> &gt; &gt; the size of the layout change.<br>
&gt;<br>
&gt; The question is how can I do it? When the embedded QGraphicsWidget need to<br>
&gt; enlarge, say from 200x200 to 400x400, how can I decide what the applet size<br>
&gt; should be?<br>
<br>
</div>Does this work?<br>
<font color="#888888"><br>
Petri<br>
<br>
</font><br>_______________________________________________<br>
Plasma-devel mailing list<br>
<a href="mailto:Plasma-devel@kde.org">Plasma-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/plasma-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/plasma-devel</a><br> \
<br></blockquote></div><br>



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic