1
如何使用QObject::connect
連接void update(*p_1, *p_2, *p_3, *p_4, *scene)
函數與timer()
?QObject ::使用update()函數的連接計時器
我想完成的是更新我已經通過指針的對象並調用*scene->update()
來刷新屏幕內容。
我有一個更新功能,看起來像這樣:
void update(*p_1, *p_2, *p_3, *p_4, *scene){
// update functions
scene->update();
}
而且在主要我有:
int main(int argc, char **argv){
// creating objects and calculations
view.show();
QTimer timer;
QObject::connect(&timer, SIGNAL(timeout()), update(&o_1, ..., &scene));
timer.start(1000);
return a.exec();
}
這是它是如何應該做:http://doc.qt.io/qt-5/qtwidgets-graphicsview-collidingmice- example.html#the-main-function – user5292408