Calling the paintGL explicitly in QT

1k views Asked by At

IN Qt, the paintGL method is called automatically due to events mentioned in this post: When is QGLWidget's paintGL called?. What do I need to do if I need to explicitly call the paintGL method from one of the class functions. void CubeView::update() { QMatrix4x4 world; double posx=drawcursor(); world.translate(posx,0,0); cube->setLocalTransform(world); std::cout<<"hi\n"; // QGLPainter paint; // paintGL(&paint);

This is follow up on my previous question as some things are now clear to me.

1. You cannot explicitly call the paintGL method in qt. 2. QGLView class does not have the updateGL method- QGLWidget has it.

Based on these my questions are:

  1. Can I use the QGL widget class in qt3d. Will I be able to use all the features likeQGL builder etc here?
  2. Is there any method in qglview which can substitute for the updategl method? Some method which is looked on before the paintgl class is called? Some function which is checked everytime before paintgl.
1

There are 1 answers

2
Fabio On

If you want to force a repaint without waiting the events processing, you can call QGLWidget::updateGL(). In this way paintGL is called immediately.