Layouts in Qt

I think I’ve finally cracked the layout mechanism in Qt Designer, it isn’t straightforward and intuitive to get set up by any means. Basically once you have various bits you want to layout you need to start looking at their sizing policy, geometry and various other bits. You also seem to need to make liberal use of the stretcher things. You basically seem to need to nest the layouts one inside another if you you want buttons for instance in a column always a certain distance apart then you have to put fixed height spacers between each one, then select all of the buttons and spacers (not just clicking and dragging a box around them) then select layout vertically. If you then want them to remain reasonably constant in size as the width of the window decreases you need more horizontal spacers of a fixed width then a horizontal layout.

At this point you discover that you left the buttons horizontal size policy set to expanding which means they try to expand to take up all of the available room (if you put this current layout box in a horizontal layout with another expanding layout box they both expand to take up half of the width, the buttons stretching to fill the space). If you decide that you meant that the buttons should stay a reasonable size you need to go back and change their horizontal size policy, unfortunately this seems to involve breaking all of the nested layouts they were part of, changing the size policies an then re-instigating each layout box.

Maybe I’m doing it wrong but there must be a quicker way than this, should the layout boxes not inherit from the current settings rather than causing the affected items to behave unpredictably. Maybe this is a known issue but as I’m in Inverness in a holiday home I can’t check at the moment.

Listening: Manu Chao – Clandestino
Reading Book: Sergei Lukyanenko – The Night Watch
Reading Magazine: Linux Journal (Issue 172 – August 2008)
Drinking: Famous Grouse (in about 5 minutes time)

And so to bed.