Is there any way to call parameterized function with timeout(), making it a class or somehow?
Is there any way to call parameterized function with timeout(), making it a class or somehow?
If you want a particular object to handle the timeout, just connect the timeout signal to a slot in the object you want to handle the timeout. Any special parameters can be encapsulated in the object as member variables.
Bill.
I can use QTimer as:
QTimer::singleShot(1500, this, SLOT(crossCapture()));
But, can this be used like:
QTimer::singleShot(1500, this, SLOT(crossCapture(int,int)));
If so, please give me an example, how?
You can't do this. You can connect signal to slot where slot has less params than signal, but can't do it the other way - because from where that slot should take values for missing arguments?
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
You could sub-class QTimer and write a new singleShot method that takes the two additional ints that you want to pass as parameters, and stores them in instance variables. It would intercept the standard timeout signal and emit a new timeout signal passing the stored values as parameters.
Bill.
Bookmarks