PDA

View Full Version : Constness issue between QGLContext::currentContext() and QGLContext::makeCurrent()?



christophe3d
4th January 2013, 14:48
I am curious why QGLContext::currentContext() returns a const QGLcontext *, but QGLContext::makeCurrent() is not const. This makes it impossible to save a context to make it current later without casting. Are there non-obvious restrictions that would make the following illegal:


QGLContext *saveContext = QGLContext::currentContext();

// [... Something that possibly changes the context ]

saveContext->makeCurrent();

wysota
4th January 2013, 18:32
Usually you'd use QGLWidget::makeCurrent()