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:

Qt Code:
  1. QGLContext *saveContext = QGLContext::currentContext();
  2.  
  3. // [... Something that possibly changes the context ]
  4.  
  5. saveContext->makeCurrent();
To copy to clipboard, switch view to plain text mode