diff --git a/src/osgQOpenGL/osgQOpenGLWidget.cpp b/src/osgQOpenGL/osgQOpenGLWidget.cpp index fe16e87..c8f827a 100644 --- a/src/osgQOpenGL/osgQOpenGLWidget.cpp +++ b/src/osgQOpenGL/osgQOpenGLWidget.cpp @@ -140,7 +140,9 @@ void osgQOpenGLWidget::keyPressEvent(QKeyEvent* event) showNormal(); setMinimumSize(g); QMainWindow* _mainwindow = dynamic_cast(parent()); - _mainwindow->setCentralWidget(this); + if(_mainwindow){ + _mainwindow->setCentralWidget(this); + } if(layout()) layout()->setContentsMargins(sMargins);