[Panel-devel] [PATCH] fix resizing applets

Robert Knight robertknight at gmail.com
Sun Sep 2 19:14:44 CEST 2007


Hi,

Right now, I consider a usable panel replacement to be the most
important thing in Plasma because I (and others presumably) need it so
that I can use KDE 4 as my main desktop for development and also to
make a very obvious visual difference between KDE 3 and KDE 4.  This
is what I have been focusing on getting working with recent changes.
These changes do cause problems for applets which had entirely
hard-coded sizes of course, but those can be fixed.

What I propose applets should do when something occurs which affects
their natural size is:

void MyWidget::someMethod()
{
   // do something which affects the size constraints
   // of the widget

   updateGeometry()
}

The applet's container (be that the desktop or the panel layout) then
takes care of updating the applet's size.  This allows the applet to
be agnostic of whether it is being used in a 'free' area such as the
desktop or a more constrained area such as the panel.

Does this sound sensible?

Regards,
Robert.

On 01/09/07, Aaron J. Seigo <aseigo at kde.org> wrote:
> On Saturday 01 September 2007, Robert Knight wrote:
> > The changes in the patch are incorrect.  contentSizeHint() is an
> > 'ideal' size for the applet, not the actual size.  The actual size is
> > given by contentSize().  If applets want to change their own size they
> > can call setGeometry().
> >
> > eg. setGeometry( QRectF(geometry().topLeft() , newSize) )
> >
> > However, this will mess up applets when they are used in layouts.  I
>
> *sigh*
>
> > to have a layout which does not place applets
>
> which means it isn't a layout at all but an external geometry manager which
> responds to sizeHint()s being set which really are setGeometry()s except
> we've fucked things up so badly elsewhere with layouts that we're now faced
> with introducing a layout that isn't a layout. genius!
>
> > but updates applets' size to sizeHint() when it changes
>
> so when an applet is in a layout it needs to set sizeHint() instead of
> setGeometry(), but when they aren't in a layout it needs to call
> setGeometry() because sizeHint() won't do anything? more genius, because
> it's
> pretty damn lame to say that applets only resize properly in a layout.
>
> i suppose we could really screw with things and in sizeHint() ask if
> parent()->layout() exists and if not make a call to setGeometry() too.
> *sigh*
>
> copying more from QWidget and having a resize() doesn't help much either
> because of the need for external constraints ... again.
>
> and that's the entire reason why i didn't want to go this route in the first
> place because unlike regular Qt widgets applets and other canvas widgets are
> naturally *constrained in size* by external geometries (e.g. panels)
>
> but eventually i just gave up discussing and said "go for it" ... the code
> would or wouldn't work and it's easier and faster to just let it go into svn
> and fix it from there. every wonder why so many FOSS projects become
> benevolent dictatorships?
>
> yeah, i'm bitter right now. i'll be better tomorrow.
>
> --
> Aaron J. Seigo
> humru othro a kohnu se
> GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
>
> KDE core developer sponsored by Trolltech
>


More information about the Panel-devel mailing list