qtqt5qwidgetqglwidget

How to add QWidget to a QGLWidget


What is currently the best way to add a QWidget to a QGLWidget as a child? In this case I want to add a QSlider to QGLWidget, however it seems like half the links on Google point to dead information now so it's tricky working out what the current way to achieve this is.

I did try creating a QSlider as a child and setting the geometry, but that didn't seem to do a lot.


Solution

  • Child widgets don't work with a QGLWidget, that's documented.

    Use QOpenGLWidget and the child widgets will work fine. There's nothing special to do in this respect, simply add child widgets, layouts, etc., and it "just works".