PaintEvent of the parent of a completely recovering child QGLWidget
I parent a QGLWidget and completely covers the parent with, with code such as:
QVBoxLayout* vbl = new QVBoxLayout;
vbl->setContentsMargins(0, 0, 0, 0);
I have discovered that if I do that, the paintEvent of my parent widget never gets called. If I replace the QGLWidget with a QWidget, it is called. If I do not set the contentsMargins to 0, it is called.
So my question is why does it do that ? Can I avoid such a behavior ?
AFAIK, if your QGLWidget covers the entire parent surface, there's no reason for the parent widget to paint anything in that zone.
What do you except to have and what are you currently getting ?
Hi and thanks for your reply.
I am trying to do something inspired from this : https://github.com/xarray/osgRecipes/blob/master/cookbook/chapter9/ch09_01/osg_qt.cpp
In this code a QWidget displays an osg (OpenSceneGraph) scene. You can see that the paintEvent of this widget has been reimplemented to command a redraw of the osg scene.
What I am trying to do is just that, but with the containing QWidget parenting the osg qglwidget and having it filling it completely. But since the paintEvent does not get called so far, it doesn't work yet without a workaround.
Like I already wrote, since your widget is completely covered, there's no reason for paintEvent to be called.
However you can try asking on the interest mailing list (you'll find there Qt's developers/mainters, this forum use more user oriented) if it's something that you can do
Ok, I'll try that. And I'll post the result here. Thanks!