PDA

View Full Version : splitter



gambr
21st November 2006, 16:02
Hi all,
I have to use Qt Designer but I'm not very familiar with such tool.

I inserted an horizontal splitter between a QStackedWidget (left) and a QFrame (right). I would like to have the following behavior. When I resize my window horizontally the right QFrame only must be enlarged while the left one must be fixed size. Anyway the user can resize both QStackedWidget and QFrame moving the splitter bar.

Can you suggest the settings to have this behavior, please?

Gianni

jpn
21st November 2006, 16:53
Try setting appropriate stretch factors through QSplitter::setStretchFactor().
Notice the example code in the docs. You could set a fixed size policy (QSizePolicy::Fixed (http://doc.trolltech.com/4.2/qsizepolicy.html#Policy-enum)) in the direction you want.

gambr
21st November 2006, 18:06
Thanks for the reply but unfortunately I have to work with QT Designer (at least for the moment). This means that the GUI file (.h) is auto-generated and it doesn't make much sense change that code. Moreover I don't like to modify the GUI settings from a derived class. So, I would like to understand how to set splitter parameters directly in QT Designer.

I tried as follows.

Left widget:
- sizePolicy
--- hSizeType = Fixed
--- vSizeType = Fixed
--- horizontalStretch = 0
--- verticalStretch = 0
- minimumSize [150, 200]
- maximumSize [16777215, 16777215]
- sizeIncrement [0, 0]
- baseSize [150, 200]

Right frame:
- sizePolicy
--- hSizeType = MinimumExpanding
--- vSizeType = Fixed
--- horizontalStretch = 10
--- verticalStretch = 0
- minimumSize [500, 450]
- maximumSize [16777215, 16777215]
- sizeIncrement [10, 0]
- baseSize [500, 450]

Now, if I stretch the window horizontally from the right side, first of all the left widget enlarges. Then after an amount of pixel the left widget stops moving and the right frame starts to enlarge. Honestly I can't explain this behavior.

Gianni