繁体   English   中英

QGLWidget updateGL()不会使用QTimer更新?

[英]QGLWidget updateGL() doesn't update with QTimer?

我有一个'QTimer'对象,想要在给定的时间间隔内重复更新'QGLWidget'。

我的问题是,当我调用'QGLWidget'的updateGL()方法时,内容不会更新。

这是我初始化QTimer的方法,

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

在slotAutoRotate()中,

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

}

我什至可以看到我在“ paintGL()”方法中编写的调试信息,但是除非将鼠标移到小部件上或进行任何其他交互,否则内容不会更新。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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