Fwd: Re: Important: QSplitter problem (fwd)

Bernd Gehrmann bernd at physik.hu-berlin.de
Tue Sep 7 15:25:25 UTC 1999

In case someone wants fix the KNewPanner related
stuff in HEAD today: please consider this. The
proposal to set the ResizeMode to KeepSize looks
quite reasonable to me in the cases where KDevelop
uses this stuff.


---------- Forwarded message ----------
Date: Fri, 14 Oct 2135 22:26:03 +0200
From: Reginald Stadlbauer <reggie at troll.no>
Reply-To: kde-core-devel at kde.org
To: kde-core-devel at kde.org
Subject: Fwd: Re: Important: QSplitter problem
Resent-Date: Tue, 7 Sep 1999 16:03:46 +0200
Resent-From: kde-core-devel at max.tat.physik.uni-tuebingen.de

FYI: Because of the KNewPanner - QSplitter discussion we just had (setting
sizes). Please cc related responses to Paul (paul at troll.no).

----------  Forwarded Message  ----------
Subject: Re: Important: QSplitter problem
Date: 07 Sep 1999 15:58:22 +0200
From: Paul Olav Tvete <paul at troll.no>

Reginald Stadlbauer <reggie at troll.no>
> Hi!
> There was just a discussion about QSplitter on kde-devel-core. Because before
> we used QSplitter in KDE we had KNewPanner. The biggest difference is that you
> coud do panner->setSeparatorPos( int ). Now in QSplitter it's only possible to
> use setSizes( QValueList<int> & ). If you have now e.g. two widgets in the
> splitter but the list of sizes contains only one size, the separator pos is
> just set to the middle or so.
> So, what people expect is that if the list contains less sizes than widgets are
> inserted, the available sizes of the list are set and the remaining sizes are
> calculated automatically. So if you have a splitter with two widget and you do
> QValueList<int> l;
> l << 20;
> splitter->setSizes( l );
> The first widget should be resized to 20 pixels, the second to
> splitter->width() - 20 (or splitter->height() - 20 depending on the orientation)
> I thought always that it worked like that. What do you think? IMO this is worth
> to go still into 2.0.2.

First of all: the only way to make sure of the size of a widget is to set
the widget's ResizeMode in the splitter to KeepSize. If you set the size
of a widget that has Stretch, the widget will be resized when the splitter
is resized. In effect, with resizeMode() Stretch you give the ratio between
the sizes of the widgets. Therefore, it is difficult to make sense out of
setSizes() with too few sizes.

If the first widget has KeepSize as its resizeMode(), your example will work
with Qt 2.0.

It is easy to change QSplitter to do what you suggest even when some of the
widgets have resizeMode() Stretch, but this will break down if you call
setSizes() before the resizeEvent().

Is it possible for KDE to use setResizeMode( firstWidget, QSplitter::KeepSize )
at least until 2.1, so that we can have a bit more time to find a good solution?

[Reggie, feel free to forward this mail]

- Paul

More information about the KDevelop-devel mailing list