[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: How to have a proper default layout with QSplitter
From: David Jarvie <djarvie () kde ! org>
Date: 2009-04-26 13:32:10
Message-ID: 200904261432.10855.djarvie () kde ! org
[Download RAW message or body]
On Sunday 26 April 2009 09:20:55 Andreas Pakulat wrote:
> On 25.04.09 21:03:37, Arnold Krille wrote:
> > On Saturday 25 April 2009 18:05:06 Andreas Pakulat wrote:
> > > I need some advice from layout experts. I've got a QSplitter here, with
> > > a filled treeview on the left part and a basically empty QWidget on the
> > > right part. But I can't get a proper initial sizement of these two, the
> > > treeview always takes the whole horizontal space. This results in nasty
> > > resizes of the dialog and movement of the splitter once there's a real
> > > widget put onto the left side.
> > > Anybody an idea how to get the treeview to not grow bigger than about
> > > 2/5th of the whole width by default?
> >
> > Make both widgets sizePolicy MinimumExanding (or Expanding), give the
> > treewidget a horizontalStretch of 2 and the other widget a stretch of 3.
>
> I've tried that, doesn't help. At least not when the right widget is a
> stacked-widget and has an empty widget inside it.
>
> > You can also set a maximumWidth for the treeview this is kind of bad gui
> > design because it might break with different fontsizes and screen
> > resolutions...
> > But it never hurts to give the treeview a minimum size.
>
> The only thing that halfway works is setting the minimum size on the
> empty widget I use as "default" in the stacked widget and then set the
> splitter's sizes via setSizes().
>
> I guess I might have to do it like the kcm-dialogs, precalculate the
> widget of all possible pages and then use that to resize the dialog and
> the right stackwidget.
I think the problem is the stacked widget. I had great problems in KAlarm
trying to make a tab widget containing scrollable sub-widgets (nothing to do
with splitters) whose sizing behaved properly. The reason was that the size of
the stacked widget used to implement a tab widget isn't calculated properly -
I had to implement a fairly complicated size calculation for the tab widget
based on the widgets inside the stacked widget.
--
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic