PDA

View Full Version : empty space in QGridLayout



eleanor
4th July 2008, 01:16
Hi:


QSpacerItem *space = new QSpacerItem(1,1);

/* layouts */
QGridLayout *sessionLayout = new QGridLayout();
sessionLayout->addWidget(hostLabel, 0, 0);
sessionLayout->addWidget(hostText, 0, 1);
sessionLayout->addWidget(portLabel, 1, 0);
sessionLayout->addWidget(portText, 1, 1);
sessionLayout->addWidget(connectButton, 2, 0);
sessionLayout->addWidget(closeButton, 2, 1);

What I want to do is this:
- I have 4 rows and 3 columns
- I need 5 rows and 4 columns where the last line + column consist of empty spaces (as big as other rows/columns)

- the problem is I don't know how to do it with QSpaceItem...I added it to sessionLayout with QGridLayout::addItem() but the problem is the size...

so any other idea how to do this efficiently?

lyuts
4th July 2008, 09:36
How about you create 2 QSpacerItems with different policies for row and for column and use addLayoutItem method?