QWidget deleting itself when on QStackedWidget
-
I can't seem to find much about this in the docs, but when you have a QWidget on a QStackedWidget, does the stacked widget remove it when the widget deletes itself (and emits the destroyed signal)?
-
Hi,
Shoudn't you just try it? I do believe that you are generating a memory leak issue here. Before you delete an object, you should verify that all used references are removed. But if you have read this:int QStackedWidget::addWidget(QWidget * widget)
Appends the given widget to the QStackedWidget and returns the index position. Ownership of widget is passed on to the QStackedWidget.
from the docs you will see that the QStackedWidget is the owner of the widget, so if you delete the widget, the parent of that widget will remove it from it's child list and I presume that it will also delete it from it's QStackedWidget list.