Moving a QWindow to/from a QWidget Container to it's own window and back...
I hope this sounds simple enough but I don't know how to do it:
I have a working QWindow implementation where I am rendering OpenGL content.
I know how to have the QWindow open in it's own window and I know how to create a QWidget rendering container to put the QWindow inside an MDI container, for example.
Here is the tricky part; I want the user to have the ability to easily switch the QWindow from being "inside" the MDI/QMainWindow to being a separate window.
So, for example, they press a "fullscreen" button on the toolbar and the QWindow pops out into a separate window while the main app is still running and then when the user hits escape then the QWindow comes right back into a QWidget rendering container.
The key here is that I don't want to destroy the QWindow or the OpenGL context; I want to maintain state.
Is this possible?
Thank you for your time.
I'm not sure if there is a quick and simple out of the box solution to this but the way I would go about it is to create a State class that holds a Ui's state (something like a Model in an MVC based system).
Then you can pass this state object between different ui's e.g pass it from your QWindow inside the QMainWindow to another QWidget that is outside.
So you can destroy/create ui's without having to destroy your OpenGL context etc.
I don't have much experience with QWindow but I guess what you need to do is to use QWindows::setParent(0) to "detach" the QWindow instance from the main application and use QWidget::createWindowContainer() to put it back into the main application.
A signal form QWindow to the main application can trigger reattaching.