[Interest] QGLWidget and QGraphicsView

Yves Bailly yves.bailly at sescoi.fr
Tue Jun 25 14:08:01 CEST 2013


Greetings all,

Using Qt 5.0.2 on Windows 7 (Visual C++ 2010), I'm trying to use a
QGLWidget-based class as viewport for a QGraphicsView, using the
setViewport() method.

However it seems the paintGL() method is never called.

The code look like this, where "Gl_Widget" inherits from QGLWidget:

QGraphicsView* view = new QGraphicsView(this);
Gl_Widget* gl_widget = new Gl_Widget(nullptr);
view->setViewport(gl_widget);

...but nothing is drawn... I've tried setViewportUpdateMode(FullViewportUpdate),
no more result. The only way I found to get something drawn is to trigger a
timer inside the Gl_Widget which would call updateGL() periodically, which
is far from optimal...

Any hint appreciated.

Regards,

-- 
      /- Yves Bailly - Software developer   -\
      \- Sescoi R&D  - http://www.sescoi.fr -/
"The possible is done. The impossible is being done. For miracles,
thanks to allow a little delay."



More information about the Interest mailing list