PDA

View Full Version : QSplitter



Solarity
10th February 2006, 16:43
I was wondering if there is a way to tell the splitter to split the screen 40/60%. It seems to base its size off of its child widgets, however, I'm trying to get my child widgets to size appropriate to the screen size. I'm not sure how to make them dynamic when the screen resizes instead of always use setMinimumWidth/Height etc. I want it to be flexible.

Also on the right half of the splitter if I don't set the minimum width it will act as if there are no widgets there at all and hides them. I really don't want to have to specify minimumWidths. Maybe I should be using baseSize?

wysota
10th February 2006, 17:14
I used something like this:

QValueList<int> list = splitter->sizes();
int s=list.front()+list.back();
list.front() = s*0.6; list.back() = s*0.4;
splitter->setSizes(list);

The list manipulation may be a little different -- the main point is to use QSplitter::setSizes().

Solarity
10th February 2006, 18:05
Thanks! Good idea.

It worked. Thanks again.