PDA

View Full Version : Layouts - very confused



lhartzman
18th July 2009, 19:55
Hello,

I'm new to Qt and have been slowly experimenting with building a GUI including looking through many of the examples.

I'm trying to put together a GUI using a main widget to add the elements to with the main widget set as the central widget in a QMainWindow.

I did some experimenting yesterday and I need to know if what I saw was correct. It seems to me that you don't get correct placement of widgets that you add and that the positioning will continue to change as the form is built. When finally done you then have to go in and tweak things to put them in the right place.

I came to this conclusion after taking the "widgets" example and commenting out everything after the inclusion of the analog and digital clock widgets (other examples) and saw that they were not in the same place as they were in the final layout.

Can anyone give me some guidelines on how to assemble a GUI with Qt so I know what to expect?

Thanks.

Les

fullmetalcoder
18th July 2009, 22:32
It seems to me that you don't get correct placement of widgets that you add and that the positioning will continue to change as the form is built.
Er... It's not a bug, it's a feature. More precisely it is the very purpose of layouts : adapting size/position according to the space available and the number of widgets (each with its own size constraints) to squeeze in it.

If you want to build fixed size layouts by hand and adjusting widget size/position by the pixel it is of course possible but it doesn't make much sense and takes a lot more time...

lhartzman
18th July 2009, 23:36
Er... It's not a bug, it's a feature. More precisely it is the very purpose of layouts : adapting size/position according to the space available and the number of widgets (each with its own size constraints) to squeeze in it.

If you want to build fixed size layouts by hand and adjusting widget size/position by the pixel it is of course possible but it doesn't make much sense and takes a lot more time...

I'm not saying that it is a bug. I'm trying to understand how to build a GUI if I don't know what to expect as I populate the form.

If I want to put a few widgets into a layout and I want them at the top of the form, what do I have to do to get them moved up to the top, just below the menu bar. If I want to move items to the bottom, what do I have to do?

I need to understand the process so I know how to make it work for me.

wysota
19th July 2009, 21:40
Use the so called "spacers". They are those little blue springs in Designer.