I don't know if it's still an actual question, but anyway:
If you're using QOpenGLWidget
(which is recommended in newer Qt versions) you can create any of existing layouts as you would normally do with a QWidget
and add your custom button into it. Here's (as an example) how it would like:
As you can see, I added a custom and fully interactive bar inherited from QWidget
on top of green QOpenGLWidget
on the left.
Also worth to mention, that you can specify Qt surface format to force use of OpenGl window rendering, using specific versions. Also if you would like to use OpenGL
in your application add an attribute QApplication.setAttribute(Qt.AA_UseDesktopOpenGL)
to use desktop OpenGL.