I tried the following:
MyFileDialog::MyFileDialog()
{
QGridLayout* mainLayout
= dynamic_cast<QGridLayout
*>
(layout
());
if ( ! mainLayout ) {
assert(0); // in case of future changes
} else {
// add some widgets
hbl->addWidget(m_cb);
int numRows = mainLayout->rowCount();
// add the new layout to the bottom of mainLayout
// and span all columns
mainLayout->addLayout( hbl, numRows,0,1,-1);
}
}
MyFileDialog::MyFileDialog()
{
QGridLayout* mainLayout = dynamic_cast<QGridLayout*>(layout());
if ( ! mainLayout ) {
assert(0); // in case of future changes
} else {
QHBoxLayout *hbl = new QHBoxLayout(this);
// add some widgets
m_cb = new QCheckBox("My Checkbox");
hbl->addWidget(m_cb);
int numRows = mainLayout->rowCount();
// add the new layout to the bottom of mainLayout
// and span all columns
mainLayout->addLayout( hbl, numRows,0,1,-1);
}
}
To copy to clipboard, switch view to plain text mode
however I'm getting the following error:
QLayout: Attempting to add QLayout "" to QFileDialog "QFileDialog", which already has a layout
Bookmarks