Qt-如何使用不兼容的信号和插槽之间的连接 [英] Qt- How to use connect between incompatible signal and slot
本文介绍了Qt-如何使用不兼容的信号和插槽之间的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做一个游戏。在这里我想调用一个函数,该函数将接收一个点。但是这个函数应该由定时器的超时信号调用。任何人都可以说如何实现这一点。以下是必需的/错误代码
I am trying to do a game. In this I want to call a function, that function will receive a point . But this function should be invoked by a timer's timedout signal. Can anybody say how to achieve this. Below is the required/error code
Point p(a,b);
connect(timer,SIGNAL(timedout()),this,startDestruction(p));
任何人都可以说如何实现这一点?
Can anybody say how to achieve this?
推荐答案
创建一个方法作为中间插槽使用。
Create a method to use as an intermediate slot, like this.
Point p(a,b);
connect(timer, SIGNAL(timedout()), this, q);
q() {
startDestruction(this->p)
}
这篇关于Qt-如何使用不兼容的信号和插槽之间的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文