PDA

View Full Version : Can't add QButtonGroup to QGridLayout



migel
27th June 2011, 17:05
gridLayout = new QGridLayout;
QButtonGroup *delGroup = new QButtonGroup();
gridLayout->addWidget(delGroup,1 , 0, 1, 2, Qt::AlignRight);

ERROR:
error: no matching function for call to 'QGridLayout::addWidget(QButtonGroup*&, int, int, int, int, Qt::AlignmentFlag)'

QGridLayout does not inherit to widget so how do I add it to ?

Santosh Reddy
27th June 2011, 17:27
QButtonGroup is not widget, it cannot be added to a layout. You need to add the actual buttons to the layout using QLayout::addWidget(), and also add the required buttons to the group using QButtonBox::addButton().

Are you sure, you want to QButtonGroup?