How to delete all widgets from QStackedWidget
? I need simply remove all widgets from QStackedWidget
.
You need to iterate through all widgets and remove each of them:
for(int i = stackedWidget->count(); i >= 0; i--)
{
QWidget* widget = stackedWidget->widget(i);
stackedWidget->removeWidget(widget);
widget->deleteLater();
}