i have 121buttons on a gridlayout. On button click i have to connect to a slot.(common to all 121buttons). This worked for me when i used connect function in a for loop.

Qt Code:
  1. for(i=0;i<121;i++)
  2. connect(buttons[i],SIGNAL(clicked()),this,SLOT(drawline()));
To copy to clipboard, switch view to plain text mode 


But i need the button no in the slot "drawline", I mean in drawline i have to get an integer value. between 1 to 121 corresponding to the button clicked.

I tryed
Qt Code:
  1. for(i=0;i<121;i++)
  2. connect(buttons[i],SIGNAL(clicked()),this,SLOT(drawline(i)));
To copy to clipboard, switch view to plain text mode 

but doesnot worked