make child widget resizable
I want to make child widgets re-sizable along with the parent. Could you help me ?
This is my widget constructor:
Code:
CustomWidget
::CustomWidget(QWidget *parent
) :{
m_button_edit.setText(tr("Edit"));
m_button_all.setText(tr("All"));
m_button_cancel.setText(tr("Cancel"));
InitializeModels();
SetTables();
splitter->addWidget(m_table1);
layout_table2->addWidget(m_table2, 0, 0, 1, 3);
layout_table2->addWidget(&m_button_edit, 1, 0, 1, 1);
layout_table2->addWidget(&m_button_all, 1, 1, 1, 1);
layout_table2->addWidget(&m_button_cancel, 1, 2, 1, 1);
temp->setLayout(layout_table2);
splitter->addWidget(temp);
}
I got some small window which I should stretch to see the items inside and they have a fixed size.
If you have any other suggestion about better approach in setting widget positions than in my case I would be glad if you share.
Re: make child widget resizable
You need to put a layout on the container widget and add the splitter to it:
Code:
// at bottom of constructor
lo->addWidget(splitter);
setLayout(lo);