You only change the body variable. Qt still has a pointer to the old widget. See QStackedWidget and QStackedLayout. Also don't forget to show the new widget.