hi all
suppose that i have two QPushButton that named A , B .
i want connect clicked signal of button A,B to a slot that take a parameter(int id).
for example: when i clicked button A, my slot be called with '1' for id parameter and about button B with '2'.
i do not know how to implement this.
i used the following code but gives me some errors.
/* in my class */
private slots:
void myslot(int id);
// *********************
/* for use this slot i use the below code */
connect(btn_A , SIGNAL(clicked()) , this , SLOT(myslot(1));
connect(btn_B , SIGNAL(clicked()) , this , SLOT(myslot(2));
/* in my class */
private slots:
void myslot(int id);
// *********************
/* for use this slot i use the below code */
connect(btn_A , SIGNAL(clicked()) , this , SLOT(myslot(1));
connect(btn_B , SIGNAL(clicked()) , this , SLOT(myslot(2));
To copy to clipboard, switch view to plain text mode
Bookmarks