1 Attachment(s)
Re: QtDesigner Layout Help
Something like this (see the attachment)?
All I did is:- placed the widgets,
- selected the main window and then "Lay Out in a Grid",
- set tree view's horizontalStretch to 1,
- set frame's horizontal and vertical stretch to 3,
- and finally set table view's vertical stretch to 1.
Do you use the newest Qt version?
1 Attachment(s)
Re: QtDesigner Layout Help
Quote:
Originally Posted by jacek
Something like this (see the attachment)?
All I did is:
- placed the widgets,
- selected the main window and then "Lay Out in a Grid",
- set tree view's horizontalStretch to 1,
- set frame's horizontal and vertical stretch to 3,
- and finally set table view's vertical stretch to 1.
Do you use the newest Qt version?
I am using 4.1.3 on OS X.
But then when I add splitters to the mix (between each of the widgets) in order to allow dynamic resizing, the real problems begin to manifest themselves. Sorry, I left this key bit of info out of the original posting since I only found that the problem was splitter-dependent after I had posted my question. Anyway, in this case, I have left your Hratios in place between the frame and the table, added a splitter between the frame and the table and then added a splitter between the grouping of these two widgets and the tree widget. I gave the table/frame splitter an Hstretch of 3 (w/no Vstretch). This captures the Hratio between the tree and these two widgets (ie: your aforementioned 1:3 ratio). However, the Vratio between the table and the frame (ie: your 1:3 ratio) falls apart and I'm not sure why. Am I missing a key setting somewhere? Please see the attachment.
Re: QtDesigner Layout Help
Indeed, splitters behave oddly (even in Qt 4.2 TP1). AFAIR you can fix that with QSplitter::setStretchFactor(), but you have to do this in code.
QSplitter docs say:
Quote:
The initial distribution of size between the widgets is determined by the initial size of each widget.
Which might mean that stretch factors are just ignored. Maybe the Trolls will be able to explain this behavior.
Re: QtDesigner Layout Help
Quote:
Originally Posted by jacek
Indeed, splitters behave oddly (even in Qt 4.2 TP1). AFAIR you can fix that with
QSplitter::setStretchFactor(), but you have to do this in code.
Which
might mean that stretch factors are just ignored. Maybe the Trolls will be able to explain this behavior.
Weird. It seems to work better when the splitter is a vertical, but when it is horizontal, all bets are off. I then thought it was the "frame" widget itself, but any other widget seems to do the same thing. I'm really at a loss at this point as I wonder how useful QtDesigner will be to my project going forward. In complex main widow-type widgets the relative size of enclosed widgets is really important, but it seems that if I want my users to be able to resize each individual widget at runtime, then I'll need to do a lot of hand coding which kinda defeats the purpose of QtDesigner.
I'm posting a bugreport now so at the very least, we will hopefully get some understanding whether it really is a bug or some sort of "feature".
Re: QtDesigner Layout Help
Hello All-
I received a follow up from Trolltech concerning the bug report I submitted. Sure enough, the order of widget instantiation does matter. To make this work with QSplitters, you must set the stretch factors on the horizontal QSplitter (the one between the table and the frame) _before_ instantiating the vertical QSplitter between the table/frame-layout and the tree view. This works and addresses my problem perfectly. I can now have the widgets of the correct size with QSplitters between.
The open issue is still that this order matters and that once you have set the stretch factors, with QSplitters involved, any future manipulation of stretch factors in future QtDesigner sessions will not be taken into account. The only way to manipulate stretch factors again would be to destroy the QSplitters and break the overall Grid layout, then make your changes, then re-instantiate the QSplitters in the correct order (and with correctly timed stretch factor changes to those QSplitters). Future versions of Qt may fix this problem, but it is a current problem nonetheless.
-Lance