The constructor you use is private, you need to use a public constructor.

Qt Code:
  1. QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
To copy to clipboard, switch view to plain text mode 

May I ask what type of program you're making? I see a class BuildingPainter which interests me.