understanding minimum/maximum/preferredSize in plasma context

Aaron J. Seigo aseigo at kde.org
Sun Dec 28 01:49:49 CET 2008


On Saturday 27 December 2008, Marcos Dione wrote:
> On Fri, Dec 26, 2008 at 11:31:22PM -0700, Aaron J. Seigo wrote:
> > On Friday 26 December 2008, Marcos Dione wrote:
> > >     hi all. I'm set to get the panel spacer to its previous behaviour
> > > when set to auto stretch, that is, to use as much space as possible.
> >
> > this applet is the right code in the wrong place. the panel ought to have
> > an expander in its layout by default; the item should not be an applet at
> > all imho but an item in the panel containment itself.
>
>     I think that leaving it as an applet makes it similar to toolbar
> editing, where you add separtors (maybe a name change?).

but a separator is not a widget in the sense that a pager or a picture frame 
or .. whatever else is. and the panel is not a toolbar (wow, i'm having 
flashbacks to end of 2007 / beginning of 2008 with that sentence; we used to 
have that conversation a lot back then =) 

it makes no sense to include it as a user visible option in the Add Widgets 
dialog. it's an implementation detail, really, and offering it to the user in 
their is exposing something we shouldn't need to.

> it's not clear
> for me how would one add a separator to a panel otherwise (i.e., how the
> feature should work)...

imho, the panel would start with a spacer. obviously that spacer would shrink 
down to 0 automagically as the panel by default is pretty full.

this would mean the user wouldn't have to do anything in most cases.

to move it or remove it, the user would simply go into panel edit mode like 
any other panel editting action.

adding a new spacer could be an action in the More Settings menu.

> > >     with this code and in my config the spacer takes some 130px, while
> > > the systray takes 490px having only 190px of icons inside, and the 3
> > > digital clocks arte wider that needed[2]. if I turn off that auto
> > > stretching, it goes down to the original 16px, but if I use the slider
> > > to effectively increase the minSize, it goes up to 710px.
> >
> > this is probably because all these applets stretch to whatever the max
> > size is if there is nothing else there. try checking their
> > preferredSize()s
>
>     actually that's the plasma Applet's default. in
> flushPendingConstrainstEvents(), except for square aspect ratios, it
> doesn't set the sizePolicy. setting it to Preferred makes it expand when
> no auto expanding spacer is present (original behaviour) and to use as
> few space as possible when one ins present (my intended behaviour).
> while I was at this, I found some duped code, so I compacted it.
>
>     here are a couple of patches, one against kdelibs/plasma and the
> other for playground/base. what's insteresting about the last one is
> that as the policy is always the same, I tried to set it in the
> constructor, but it gave a wrong behaviour. I had to move it back to
> constrainsEvent().

the kdebase patch looks right.. i actually just cleaned up that method the 
other week without touching any of the actual logic; there was code for 
changing things all over place after months of development and various people 
fiddling with it. interesting what becomes apparent when the code is sanitized 
a bit.

-- 
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 Qt Software

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20081227/b9b39036/attachment.sig 


More information about the Plasma-devel mailing list