understanding minimum/maximum/preferredSize in plasma context

Marcos Dione mdione at grulic.org.ar
Sat Dec 27 05:22:02 CET 2008


    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.

    now, the code is simple: it takes the size of the container (if it's
an horizontal panel, it takes the width), then loops through all the
applets/plasmoids on it and substracts its preferred size. whatever is
left is used as a reference maximumSize (in this case, width).

    actually, what it really does is this: it sets the minimumSize to
the min between this and the previous minSize (begins at 16 or so). if
it's not auto stretching, is sets the maxSize to the same value,
obiously forcing it to be of that size. if it is, it sets the maxSize to
-1. I guess this value means something special, but QGraphicsWidget API
(actually QGraphicslayoutitem[1]) says nothing about it.

    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. 

    suspecting those -1, I modified the code to set the maxSize to the
reference maxSize calculated as above, and it still is doesn't stretch.
seems like the only way to get some space in the panel is asking in some
forced way (by setting the minSize), instead of setting a min and a max
and letting the panel to guess the right one... maybe is it because the
other applets also ask for as much space as possible? I think plasma is
either reinventing the layout code that already exists in QT or the
applets are not behaving as they should.

    also, and finishind this longish mail, wehre does the preferredSize
come from? is it calculated? and last but not least, is there really
pretty pretty please some docs about this, including how
constraintsEvent() works/should work? I loked in plasmas' site and wiki
to no avail. sebas sent me to read the API but didn't find anything
conclusive.

    cheers, 

	Marcos.

--
[1] http://doc.trolltech.com/4.4/qgraphicslayoutitem.html#setMinimumWidth

[2] http://grulicueva.homelinux.net/~mdione/gallerpy/index.py/pictures/sshots/plasma_panel-spacer_does_not_grow.png
--
(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


More information about the Plasma-devel mailing list