I've subclassed QGLWidget to make my own OpenGL rendering context. I've been having wierd issues when testing the .exe on other computers, though, so I've tried to explicitly set the OpenGL version to 3.1 in the constructor:
Qt Code:
  1. glWidget::glWidget(QWidget *parent) :
  2. QGLWidget(parent)
  3. {
  4. QGLFormat newFormat;
  5. newFormat.setVersion(3,1);
  6. glWidget::context()->setFormat(newFormat); //error here
  7. glWidget::setMouseTracking(true);
  8. }
To copy to clipboard, switch view to plain text mode 
On the line that says "error here", I'm getting the following:
Qt Code:
  1. C:\Qt\qtcreator-2.5.2\project\1KEdit\glwidget.cpp:15: error: C2662: 'QGLContext::setFormat' : cannot convert 'this' pointer from 'const QGLContext' to 'QGLContext &'
To copy to clipboard, switch view to plain text mode 
I've tried rearranging it inside the constructor, but I'm always getting one error or another. I took the answer to this question as an example: http://stackoverflow.com/questions/5...get-at-runtime

How do I properly use setFormat?