http://www.trentreed.net/blog/qt5-opengl-part-0-creating-a-window/
Follow thoose tutorials or at least the part 0, 1 ,2 ,3a, 3b and you will have decent basis to start.
In the tutorial he use QOpenGLWindow which isn't really far from QOpenGLWidget so I think you should be able to adapt his code a bit to suit your need but if you didn't succed to do it ask here again.
Do you look for opengl ressources to ?