OpenGLWidget in QDockWidget stays black while floating
-
Hello,
I have a class derived from QOpenGLWidget. When I put it on the mainwindow or in a QDialog it works as intend.
However when I add the same widget to a QDockWidget it stays black, but only when its floating. As long as it is docked it also works.I've also tried to subclass QDockWidget and add
QSurfaceFormat fmt; QSurfaceFormat::setDefaultFormat(fmt);
To the constructor, but that does not help.
Any ideas how to solve this?(I'm using Qt5.15 on Debian)
-
Hi,
Please provide a minimal compilable example that shows the behaviour.
-
@SGaist
I've set up a minimal example based on the OpenGL Cube example in QtCreator.
You can download it hereHowever in the example the OpenGL widget is getting gray not black when undocked, so it differs a bit from the other project.
I still hope it can show the problem.
EDIT: also what I noticed. When I directly set it flaoting in the constructor its fine as well. So its not the floating, but the docking/undocking that kills it. -
@mrjj Thanks a lot for checking.
I'll submit it to the bug tracker then.
Also I just found a work around how it can be fixed.
SettingQCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
Will solve the problem. I though haven't tested out if this will lead to other problems yet.
-
Hi
Np, when providing a full project that i can just run :) any time then.Ah that kinda makes sense when you show it :)
So when in Mainwindow they are part of the same context but when in a window (floating)
they need to share the context. ( or something like that )https://forum.qt.io/topic/63771/multiple-contexts-using-qopenglwidget/2
I dont think you will get any issues with it as it seems to be made for such case.
-
-