4

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 ?

whatnick
  • 5,400
  • 3
  • 19
  • 35

1 Answers1

2

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 theGLWidget is reparented between tabWidget and theFullScreenFrame. Under Windows, reparenting a QGLWidget will lead to a recreation of the QGLContext. (see QGLWidget documentation

The 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.

Johannes S.
  • 4,566
  • 26
  • 41