I'm trying to implement a stack solution in my application so I can push and pop widgets into the stack. I'm using a QStackedWidget. When a widget is removed from the stack I want to make sure that it is also deallocated. In my code below will the pageWidget get deleted and deallocated when I run removeWidget()? Or will it be deleted when stackedWidget is deleted? How can I make it get deleted when it is removed from the stackedWidget?
stackedWidget->addWidget(pageWidget);
//Will this delete this pageWidget and deallocate memory?
stackedWidget->removeWidget(pageWidget);
QStackedWidget *stackedWidget = new QStackedWidget(this);
QWidget *pageWidget = new QWidget(stackedWidget);
stackedWidget->addWidget(pageWidget);
//Will this delete this pageWidget and deallocate memory?
stackedWidget->removeWidget(pageWidget);
To copy to clipboard, switch view to plain text mode
Bookmarks