I am integrating a single osgQt::GLWidget in a Qframe and using the pattern here: http://trac.osgeo.org/ossim/browser/trunk/ossimPlanetQt/src/gui/ossimPlanetQtMainWindow.cpp to switch between full-screen mode and back. Basically consuming the keystrokes within the widget and setting full screen from there.
I also have an event consumer in osgViewer::Viewer – osgViewer::WindowSizeHandler which handles the viewer size switch.
Is there a better pattern to implement this ?
Basically, what you do (or, what is done in the example) seems fine. (Note that I am assuming that you refer to
void ossimPlanetQtMainWindow::on_viewToggleFullScreen_triggered(bool ))However, in the example, the QGLWidget
theGLWidgetis reparented betweentabWidgetandtheFullScreenFrame. Under Windows, reparenting aQGLWidgetwill lead to a recreation of the QGLContext. (see QGLWidget documentationThe workaround suggested by the docs is to wrap the GL widget in a dummy widget (a simple
QWidget) and reparent that instead of the GL widget.In my experience, this works fine.