understanding minimum/maximum/preferredSize in plasma context

Marcos Dione mdione at grulic.org.ar
Sat Dec 27 21:19:20 CET 2008


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?). it's not clear
for me how would one add a separator to a panel otherwise (i.e., how the
feature should work)...

> >     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().

> if you read the code, you'll see that that's not the case.

    yeah, I should have. it was rather late in the night then...

-- 
(Not so) Random fortune:
- The human psyche is an odd and contradictory thing, isn't it Bob...
- Well... being a lawyer, I pretty much bunk on it.
	    -- http://www.ucomics.com/nonsequitur/viewnq.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: panel_spacer-set_size_policy.diff
Type: text/x-diff
Size: 946 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20081227/3326e8ee/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma_applet-set_size-policy.diff
Type: text/x-diff
Size: 1644 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20081227/3326e8ee/attachment-0001.bin 


More information about the Plasma-devel mailing list