Derived QGLWidget
-
Hello,
i have a derived QGLWidget that has a lot of functionality built into it and now i want to show translucent widgets on top of the graphics scene. in following the http://doc.qt.nokia.com/qq/qq26-openglcanvas.html the actual openglscene is derived from QGraphicsScene. will i now have to rewrite the previous derived viewer class to use the functionality from QGraphicsScene or is there a better way without my having to duplicate and rewrite the previous code? in other words, is there any way for me to use my derived class directly but still be able to draw widgets on top of the scene?
thanks for any help
-
The Problem I see is that QGLWidget, although often used with Graphics Views, actually is not part of the Graphics View Framework, but a standalone widget for OGL Interaction. But the convenience with proxy widgets (QGraphicsProxyWidget is what is used when embedding widgets in graphics scenes) needs the Graphics View Framework, i.e. a QGraphicsScene.
Are you sure it's that much work involved to change from QGLWidget to QGraphicsView (which also is a QWidget after all) and use drawBackground instead of paintGL, and the scene for the widgets?
Another Idea that will probably not work, but that's worth a try: Create a QGraphicsView and then use setViewport with an instance of your derived QGLWidget.
-
thanks for the reply. the first thing i thought of was your last sentence but i can see it breaking down right away so i did not pursue it. i think that i will have to replicate the code for the QGLWidget derived widget to QGraphicsScene and i hope that it is not that much work but we will see.