Removing the Central Widget in QMainWindow...
-
Hello,
Apologies if this is a very simple question but how do I remove or delete the central widget in a QMainWindow instance?
Basically I want to have a "File Close" type action that just takes folks to a blank central widget after they are done with the Widget I load in the central area.
Thank you for your time.
-
Hi,
There's two use case here:
Remove and re-use the widget
Delete the widget
In the first case you have takeCentralWidget, then it's up to you manage the lifetime of this widget.
In the second case, just call setCentralWidget(0)