Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.12.4
-
None
-
Win10/osx mojave/Ubuntu 18.04
-
-
ce2fc51914f809369d5096e7a0621229dd9eaef9 (qt/qtbase/5.13) 28b138cbc21c4bed7b18b70bb98a690d000ad2f9 (qt/qtbase/5.12)
Description
I use the Qt::AA_ShareOpenGLContexts application flags to enable context sharing accross top level window. I've checked that the qt_gl_global_share_context() is vaild.
When i create a QOpenGlWidget as a child of a floating QDockWidget, it fails to create its openGL context shared with the qt_gl_global_share_context().
It seems to be an issue with the source code of the QOpenGLWidgetPrivate::initialize(). This method is supposed to init the Widget context from the shareContext of its top level window. But in my case, there is not top level window and thus the call to get(tlw)->shareContext(); returns null. This is what we expect, but in my case since i have the Qt::AA_ShareOpenGLContexts flag set, i would expect that it fallbacks on the qt_gl_global_share_context() but it doesn't.
The QQuickWidgetPrivate::createContext() method is doing something similar to QOpenGLWidgetPrivate::initialize() but it takes into account the qt_gl_global_share_context(). By replacing the code related to the shareContext of QOpenGLWidgetPrivate::initialize() by the one in QQuickWidgetPrivate::createContext(), it works as expected.