QGLWidget updateGL() doesn't update with QTimer?

痞子三分冷 提交于 2019-12-12 01:35:26

问题


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:


You must use update() instead of updateGL()



来源:https://stackoverflow.com/questions/4468846/qglwidget-updategl-doesnt-update-with-qtimer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!