0
votes

I have a 'QTimer' object and want to update 'QGLWidget' repeatedly in a given time interval.

My problem is that ,content doesn't get updated ,when I call updateGL() method of 'QGLWidget'.

Here's how I init the QTimer,

rotationTimer=new QTimer();
rotationTimer->setInterval(500);
QObject::connect(rotationTimer, SIGNAL(timeout()), this, SLOT(slotAutoRotate()),Qt::QueuedConnection);

in the slotAutoRotate(),

void RzState3DCurveSelect::slotAutoRotate()
{
    RzStateMachine3DCurves *sm3d =(RzStateMachine3DCurves*) this->getStateMachine();
    setYRotation(yRot+5);       
    sm3d->getQGLWidget()->updateGL(); // <---- call updateGL() of the widget.
    //QApplication::processEvents();

}

I even can see the debug information that I write in side 'paintGL()' method, but the content doesn't get updated, unless I move mouse over the widget or any other interaction.

1
try sm3d->getQGLWidget()->update(); after the updateGL()Frank Osterfeld
thanks Frank ,you saved my day! It worked.. could you make this an answer so that I can mark it as correct? thanks again.Ashika Umanga Umagiliya

1 Answers

2
votes

You must use update() instead of updateGL()