PDA

View Full Version : Is there any way to convert a generic function to slot ?



tonnot
18th April 2011, 21:25
I'd want to write something like this

connect (a,signal(a),this, convert_to_slot(my_function))

Fiction science ?
Thanks

poporacer
18th April 2011, 21:35
Why not declare my_function as a slot? You can still call it in a normal way.

Zlatomir
18th April 2011, 22:03
Or, if the function is not your code, create your own slot, connect the signal to that slot, and within that slot call the function.


//slot definition
void THIS_CLASS::my_slot(...) {
my_function(...); //call my_function
}
//connection
connect (a,signal(...),this, my_slot(...))