PDA

View Full Version : Layout woes



hgiese
3rd September 2009, 18:25
Hello out there,
slowly advancing on Qt's learning curve some things already work. However I am using nested layouts and the result looks plain ugly, probably due to the default values for spacing/margins.

Problem no. 1: My central widget is a splitter, and this widget cannot be chosen from within QtDesigner - or can it?

So I am left with creating the layouts at runtime, and this leads to
Question no. 2: Experimenting programmatically with different values for e.g. setContentsMargins() is tedious: Change one value, compile, run, no - doesn't look any better, goto step 1, ...
I wonder: Is there a way one could influence these settings from within the debugger? Then I could set a break point on some signal handler, try out other values and continue.

How do the you, the more experienced developers, handle this?
Oh, in case it matters: This is Qt 4.5.2 on Windows XP.
Any help will be greatly appreciated.
Best regards
Helmut Giese

wysota
3rd September 2009, 19:50
Problem no. 1: My central widget is a splitter, and this widget cannot be chosen from within QtDesigner - or can it?
Yes it can. Select at least two widgets on your form and choose one of the two splitter options from the layout toolbar (splitters are not available in the widget box).


Question no. 2: Experimenting programmatically with different values for e.g. setContentsMargins() is tedious: Change one value, compile, run, no - doesn't look any better, goto step 1, ...
You shouldn't touch setContentsMargins. If you have to adjust margins or spacing, use QLayout::setMargin() and QLayout::setSpacing().


I wonder: Is there a way one could influence these settings from within the debugger? Then I could set a break point on some signal handler, try out other values and continue.
Use Designer instead.


How do the you, the more experienced developers, handle this?
See the answer above :)

hgiese
3rd September 2009, 20:29
Hi wysota,

Yes it can. Select at least two widgets on your form and choose one of the two splitter options from the layout toolbar (splitters are not available in the widget box).
thanks a lot - now this sounds _really_ helpful. Being able to work with the designer should be a lot easier.


You shouldn't touch setContentsMargins. If you have to adjust margins or spacing, use QLayout::setMargin() and QLayout::setSpacing().
Now that I know about the 'splitter options' I probably won't have to.

I'll give it a try tomorrow - kind'a late over here by now.
Again many thanks for your advice and best regards
Helmut Giese