PDA

View Full Version : Adding line in layout.



Niamita
17th October 2011, 12:33
Hi

I am trying to add line in a layout through coding, but i do not find name of line class.I am trying to add line which are present in qt designer toolbox.
please tell me how to add them in a layout.
One more thing when i am adding space in a gridlayout , it does not effect anything in display.
My code for adding space is


QSpacerItem *spacerItem = new QSpacerItem(300, 20, QSizePolicy::Expanding);
grid->addItem(spacerItem, 4, 0, 4, 1);

Actually i want to leave first column of layout blank.

wysota
17th October 2011, 12:35
Actually i want to leave first column of layout blank.
Then just don't add anything there and it will be blank.

Niamita
17th October 2011, 12:39
i do the same but second column widget stretch in first and second column.

wysota
17th October 2011, 13:20
Should any line in first column contain something that is not empty? If not, what is the point in having the empty space in the first place?

Niamita
17th October 2011, 13:29
I have gridlayout which i want to set in window after leaving some gap from left of the window(like first column in whole layput does not contain any widget).

wysota
17th October 2011, 14:56
Ok, but my question is why you want to leave the gap. You can do that using the spacer code you posted if you use the Minimum size policy however that's probably not the best solution.