Here's the code I wrote:
SettingDialog::SettingDialog()
{
ui.setupUi(this);
setLayout(ui.vLayout);
ui.vLayout->addWidget(tabWidget);
...
QMapIterator<QString,
QWidget*> i
(pages
);
while(i.hasNext())
{
i.next();
tabWidget->addTab(i.value(),i.key());
}
}
SettingDialog::SettingDialog()
{
ui.setupUi(this);
setLayout(ui.vLayout);
tabWidget = new QTabWidget(this);
ui.vLayout->addWidget(tabWidget);
...
QMapIterator<QString,QWidget*> i(pages);
while(i.hasNext())
{
i.next();
tabWidget->addTab(i.value(),i.key());
}
}
To copy to clipboard, switch view to plain text mode
I have a QMap<QString,QWidget*> which stores a lot widgets for me.And then I want to add each to a new tab in the tabWidget.
When I resize this SettingDialog,the tabWidget will be resize too.But the content(the widgets I added) won't resize.I know if I want it auto-resize,I need QLayout.But I don't know how to add the layout.
---Edit----
I have figured it out~
Bookmarks