I have a program in which a number of combo boxes are created and this number is equivalent to the length of an array. I need to make sure that when the signal currentIndexChanged is sent to my slot, the slot knows the index of the combo box and which combo box sent it. The index of the first combo box needs to written to the first element in the array. To do this the slot needs to know which combo box sent the signal. I tried accomplishing this through QSignalMapper but that can only send one parameter. I also tried using the sender() function but the return is an object not the number of the object. Is there any way I can accomplish this?
int lenght = sizeof(countries)/sizeof(countries[0]);
for(int x=0; x<=lenght-1; x++)
{
QComboBox* combo = new QComboBox;
combo->addItem("Present");
combo->addItem("Present and Voting");
combo->addItem("Absent");
combo->addItem("Absent from Commitee");
formLayout->addRow(countries[x],combo);
connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(roll(int)));
}