Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QGraphicsView::setupViewport() and createWindowContainer() don't play nice
Hauke last edited by
I am migrating from Qt4 to Qt5 and things went smooth ... so far. In the past we used to set a QGLView (from qt3d) as the viewport of QGraphicsView. Since QGLView inherits QWindow in Qt5, I thought createWindowContainer() could be of help and nested the QGLView in such a container.
The problem is now that the GraphicsView does not recognize the returned QWidget as OpenGL capable because it checks if the viewport widget inherits QGLWidget. The widget returned by createWindowContainer() does not and cannot inherit from QGLWidget.
I considered two solutions:
- write a class mimicking QGLView while inheriting QGLWidget (as it used to be in Qt4)
- write my own createGLWindowContainer() which returns a QGLWidget
I would really appreciate any suggestion.