how to divide QGridLayout into rows and columns at Design Time in QT?

Viewed 22897

how to divide QGridLayout into rows and columns at Design Time in QT ?

I want to design one form where i want to have 2 columns and 7 rows . I am designing using QTCreator but i am not getting any option of giving rows/columns.

It shows only these properties

enter image description here

3 Answers

You can often drag a new UI element to a position between two existing columns to create a new column - the GUI indicates that it's ready to create a new column by showing a blue vertical line to the user (same thing for creation of a new row with a horizontal blue line).

If instead it is showing a red line or outline, that's indicating that it will fit the element currently being dragged into the existing row/column grid at the indicated position, without creating a new row or column.

It can sometimes be quite difficult to get the GUI to play nice - I've have a number of occasions where I can follow this process to create a new column - but not if I try to place the UI element on the row I actually want it on - so instead I end up dropping it on another row to create the column, dropping another of the same UI element where I actually want it, and deleting the first (superfluous) UI element.

Alternatively, it can quite often be easier to simply right click the element with the layout set, select "break layout" from the layout menu, move things about manually and then go back and select "layout in grid" (or whichever other option) from that layout menu - hoping that it will correctly guess where you want things to go in terms of rows and columns. It's usually pretty good at that.

But yes, it probably would be nice to be able to force create a new column/row in a grid layout (perhaps with some default UI element - a label, maybe - inserted as a placeholder to keep the new row/column open) at a predefined position within the grid for those times when the GUI just does not want to play nice.

Related