I have a QMainWindow with 2 QTreeViews, next to each other horizontally. The one on the left is smaller than the one on the right. But when I choose Layout Horizontally, they automatically become equal sizes. How can I keep the one on the right bigger than the one on the left?
I think that YourTreeView->setMaximumSize could help you with what you want
Try to use horizontalStretch
Thanks for the answers. Sorin's answer works if you want one of the QTreeViews not to get bigger than a certain size (like in my case). Denis Kormalev's answer is good if you want to keep them proportionate to each other.
Or you can use a splitter and let the user choose the relative sizes of the tree views.
My situation is exactly the same and i like to use QSplitter in this scenario.
But HOW do i achieve this with QDesigner???
In the "Layout" submenue of the context menu of QMainWindow in the object view, the two optiones with splitter are grey/inactive - in the toolbar, too. wtf?
How can i actually use them?
And yes, there is one widget inside "centralwidget" - two widgets dont help either.
PS: Using QDesigner 4.7.0 on Windows.
The splitter itself is a widget.
SO select the widgets you want to use in the splitter, layout them by the splitter and put a V or HBoxLayout on the main window.
Or use the splitter as central widget.
Thanks for your answer.
But in my opionion you missed the point. Sorry. But i forgot to mention, there is no Splitter widget in QDesigner wigdet toolbox!
The question remains, how do i do this with QDesigner 4.7.0 ?
Or do i just dont get it?
Got the "Form" menu and select "Lay Out Horizontally in a Splitter".
Ok, got it now.
I didnt know that i actually need two "layouts" in the right order. (Though the splitter is no real layout, i know).
First the splitter "layout" on the two wigdets. Then the layout of the main window (for dynamic resizing of the widgets).
A always applied the layout of the main window first, but then your stuck. And there is no splitter option in the first place.
Thanks a lot.
Nice, that it works now.
You're right, the order of layouts is important, but easy to memorize: Always layout from the inner pieces to the outer, single widgets to groups, groups to bigger groups and the toplevel layout at the very end.
And now Gerolfs post makes sense to me.