jiapei100
12th February 2013, 13:54
Hi, all:
I followed the code on page http://doc.qt.digia.com/4.7-snapshot/widgets-groupbox.html . The code patch is attached:
QGroupBox *groupBox = new QGroupBox(tr("Exclusive Radio Buttons"));
QRadioButton *radio1 = new QRadioButton(tr("&Radio button 1"));
QRadioButton *radio2 = new QRadioButton(tr("R&adio button 2"));
QRadioButton *radio3 = new QRadioButton(tr("Ra&dio button 3"));
radio1->setChecked(true);
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(radio1);
vbox->addWidget(radio2);
vbox->addWidget(radio3);
vbox->addStretch(1);
groupBox->setLayout(vbox);
Since groupBox is a QWidget, I would like add groupBox into a widget cell as :
ui->tableWidget->setCellWidget(0, 4, groupBox);
But it seems this doesn't work for me at all. Those radios can't show up at all.
Can anybody help to let me know if it's possible to put a groupBox into a tableWidget cell? If so, how?
Thanks
Pei
I followed the code on page http://doc.qt.digia.com/4.7-snapshot/widgets-groupbox.html . The code patch is attached:
QGroupBox *groupBox = new QGroupBox(tr("Exclusive Radio Buttons"));
QRadioButton *radio1 = new QRadioButton(tr("&Radio button 1"));
QRadioButton *radio2 = new QRadioButton(tr("R&adio button 2"));
QRadioButton *radio3 = new QRadioButton(tr("Ra&dio button 3"));
radio1->setChecked(true);
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(radio1);
vbox->addWidget(radio2);
vbox->addWidget(radio3);
vbox->addStretch(1);
groupBox->setLayout(vbox);
Since groupBox is a QWidget, I would like add groupBox into a widget cell as :
ui->tableWidget->setCellWidget(0, 4, groupBox);
But it seems this doesn't work for me at all. Those radios can't show up at all.
Can anybody help to let me know if it's possible to put a groupBox into a tableWidget cell? If so, how?
Thanks
Pei