Reputation: 4499
I understand that we could use QSignalMapper to collect a set of parameterless signals, and re-emit them with integer, string or widget parameters corresponding to the object that sent the signal.
But could we do the reverse? For example, is it possible to achieve:
connect(control,startVehicle(0),vehcileList[0],startReceived());
connect(control,startVehicle(1),vehcileList[1],startReceived());
connect(control,startVehicle(2),vehcileList[2],startReceived());
instead of having 3 different signals from control as
startVehicle_1();
startVehicle_2();
startVehicle_3();
Upvotes: 1
Views: 337
Reputation: 40512
There is a simpler way:
connect(control, SIGNAL(startVehicle(int)), this, SLOT(startReceived(i)));
//in startReceived(i) slot
vehcileList[i]->startReceived();
Upvotes: 1