PDA

View Full Version : QSplitter in Designer



eiswand
5th December 2010, 12:53
Hello,

I have a QSplitter (horizontal), that contains 2 QListWidgets. Now I want that the first (left) QListWidgets gets ALL the space if the Window is resized (the user still should be able to resize per splitter).
In code I can do this easily by calling:
splitter->setStretchFactor(0, 1);

But is it possible to do this (setting stretch factors if a QSplitter) in Qt Designer? I haven't found this property in Qt Designer.

franz
5th December 2010, 18:43
It isn't a property of QSplitter. From the setStretchFactor() docs (http://doc.trolltech.com/latest/qsplitter.html#setStretchFactor):

This function is provided for convenience. It is equivalent to

QWidget *widget = splitter->widget(index);
QSizePolicy policy = widget->sizePolicy();
policy.setHorizontalStretch(stretch);
policy.setVerticalStretch(stretch);
widget->setSizePolicy(policy);

This means you'll have to set the properties of the relevant widgets, rather than on the splitter.