简体   繁体   中英

QGLWidget updateGL() doesn't update with QTimer?

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.

您必须使用update()而不是updateGL()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM