You only create a new widget and assign it to some variable. There is no "replacement" going on. If you want to replace one widget with another then either use QStackedWidget or delete the old widget and place the new one in a layout where the old widget was.
Bookmarks