#include <QtGui>
int main(int argc, char **argv)
{
radio1->setChecked(true);
vbox->addWidget(radio1);
vbox->addWidget(radio2);
vbox->addWidget(radio3);
vbox->addStretch(1);
groupBox->setLayout(vbox);
w.setCellWidget(0, 0, groupBox);
// This:
w.resizeRowToContents(0);
w.resizeColumnToContents(0);
// or this:
// w.verticalHeader() ->resizeSection(0, groupBox->sizeHint().height());
// w.horizontalHeader()->resizeSection(0, groupBox->sizeHint().width());
// might be good places to start
w.show();
return app.exec();
}
#include <QtGui>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QTableWidget w(6, 6);
QGroupBox *groupBox = new QGroupBox("Radio Buttons", &w);
QRadioButton *radio1 = new QRadioButton("&Radio button 1", &w);
QRadioButton *radio2 = new QRadioButton("R&adio button 2", &w);
QRadioButton *radio3 = new QRadioButton("Ra&dio button 3", &w);
radio1->setChecked(true);
QVBoxLayout *vbox = new QVBoxLayout(groupBox);
vbox->addWidget(radio1);
vbox->addWidget(radio2);
vbox->addWidget(radio3);
vbox->addStretch(1);
groupBox->setLayout(vbox);
w.setCellWidget(0, 0, groupBox);
// This:
w.resizeRowToContents(0);
w.resizeColumnToContents(0);
// or this:
// w.verticalHeader() ->resizeSection(0, groupBox->sizeHint().height());
// w.horizontalHeader()->resizeSection(0, groupBox->sizeHint().width());
// might be good places to start
w.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks