athulms
29th September 2011, 12:45
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.
for(i=0;i<121;i++)
connect(buttons[i],SIGNAL(clicked()),this,SLOT(drawline()));
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
for(i=0;i<121;i++)
connect(buttons[i],SIGNAL(clicked()),this,SLOT(drawline(i)));
but doesnot worked
for(i=0;i<121;i++)
connect(buttons[i],SIGNAL(clicked()),this,SLOT(drawline()));
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
for(i=0;i<121;i++)
connect(buttons[i],SIGNAL(clicked()),this,SLOT(drawline(i)));
but doesnot worked