现有一个类
class GraphWidget : public QGraphicsView
{
protect void timerEvent2(QTimerEvent *event);
}
Constutor
GraphWidget::GraphWidget()
{
QGraphicsScene *scene = new QGraphicsScene();
startTimer(2000/50);
}
void GraphWidget::timerEvent2(QTimerEvent *)
{
printf("timer2");
}
int main(int argc, char **argv)
{
QApplication app(argc, argv);
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
GraphWidget widget;
widget.show();
app.exec();
return 1;
}
然后这个timer就是不触发事件输出timer2.
谢谢!