Important: Please read the Qt Code of Conduct -

QGLWidget::setFormat not working as expected.

  • I need t to be able to change prefs of format for a QGLWidget dynamically without loosing the context. For example, I should be able to enable or disable vsync at runtime and enable this per widget. I tried with getting the format, setting the vsync option and setting the format back to the widget, however nothing seems to happen.
    In case of vsync, its always turned on irrespective of what I have set the value to be.


  • I am pretty sure you can not do that. However, you could try creating a root/hidden QGLWidget (and associated context) and have your QGLWidget(s) share context with that root widget.
    Then when you need to change the format of one widget, delete that widget and replace it with a new one using the proper format and sharing context with the hidden QGLWidget.

Log in to reply