Hello friends, I am using multiple QPushButtons in my project. All of them should go inside 1 slot. So i am using QSignalMapper. My ui object is UI. And the pushbuttons are already created in designer. Lets say they are named pushbutton1, pushbutton2, etc. Now i want to map all of them in a signal mapper. So one would ideally use a for loop
Syntax :
for(i=0;i<10;i++){
connect(UI.pushbutton[i],SIGNAL(clicked()),signalmapper,SLOT(map()));
signalMapper->setMapping(UI.pushButton[i],i);
}

signalMapper is my object. With this code i can send the values to the slot and depending on that value i can take decisions. But it fails, compiler says, it doesnt know pushButton. But when i put pushButton1 or 2, it works. How to get that i in a for loop part working? Kindly let me know. Thank you for your time.