PDA

View Full Version : QVBoxLayout and QGridLayout Problem



eLancaster
6th December 2010, 15:17
QGridLayout *grid = new QGridLayout;
for(int row=0;row<4;row++)
{
for(int column =0;column<4;column++)
{
grid->addWidget(new LCDRange,row,column);
}
}

QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(close);
layout->addWidget(grid);//ERROR
setLayout(layout);

ERROR = no matching function for call to ‘QVBoxLayout::addWidget(QGridLayout*&)’.candidates are: void QBoxLayout::addWidget(QWidget*, int, Qt::Alignment)



Could someone please tell me how to get rid of this error. Thanks.

Zlatomir
6th December 2010, 15:23
The function name is addLayout(...) the addWidget function can add only widgets

eLancaster
6th December 2010, 20:33
Thanks, that worked - but now I have another error

QWidget::setLayout: Attempting to set QLayout "" on grid "grid", which already has a layout on the same line