Change the central widget of QMainWindow
-
Hi,
I have many widgets I derived from QWidget and I want to use them as central widget each time it is needed, how can I do this? -
-
Hmm,
Would it not be better to have stackedWidget be placed in the centralWidget and then simply set a different widget on top?? -
Yea I don't think changing the central widget works. I believe I read in the qt docs that it was unsupported. Although this could have been a long time ago and changed.
I would go with Jeroentje's solution and put a central stacked widget and then just change what it shows. In fact that is the exact approach I have used in the past when I needed this behavior.
-
Thanks a lot, that was very helpful. I've just passed my las 3 hours for searching about clearing the qwidget surface and repaint it with what I want. Through Qt doc, I think it is not possible, that is very stressful!!! Thanks for your help, I did this because I'm wondering how to handle the changing of my window title...
-
[quote author="kekule" date="1403829537"]I did this because I'm wondering how to handle the changing of my window title...[/quote]
@mainWindow->setWindowTitle()@