How to create an embedded openGL viewer and draw in it

Check Questions about Qt and Root
and Using OpenGL in a compiled program
You may find it useful