You better use a QStackedWidget.
I think the problem is that you add widgets to both layouts, and you delete one of them. You should add the widgets to the second layout after the first one is deleted.
This code:
Creating the layouts with parents causes them to be set just as using setLayout.Qt Code:
To copy to clipboard, switch view to plain text mode
Bookmarks