Important: Please read the Qt Code of Conduct -

How to bail on the creation and display of 5.1 OpenGL QGLWidget window

  • You have to new the QGLWidget and call the .show() to get the initializeGL, resizeGL, and paintGL methods to fire. What if you run into a problem on the initializeGL method, and want to bail? How can I stop the window from being displayed? I've tried deleting "this", and bad things happened. Is there a clean way to unwind the stack and prevent the resizeGL and paintGL calls from being made?

    I suppose I could make the window invisible, set a timer, and delete it after it is fully initialized. But there must be a better way ...

Log in to reply