
Originally Posted by
Santosh Reddy
You need to associate each button with the row number, when you create the button. One way to do so is sub-class QPushButton and add a member variable (say buttonRow), and store the row number in it when you create the button. Now in the slot connected to clicked signal, check the member var.
Could you explain"check the member var"?
I sub-class QPushButton as follows:
{
public :
myPushButton
(QString txt,
int mrow
);
private:
int row;
}
myPushButton :public QPushButton
{
public :
myPushButton (QString txt,int mrow);
private:
int row;
}
To copy to clipboard, switch view to plain text mode
and use it as follows:
...
for(int i=0;i<count();i++)
{
....
myPushButton *myBtn=new myPushButton("convert",i);
connect(myBtn,SIGNAL(clicked()),this,convertSlot());
}
...
void TableMyclass::convertSlot()
{
how to check the row?
}
for(int i=0;i<count();i++)
{
....
myPushButton *myBtn=new myPushButton("convert",i);
connect(myBtn,SIGNAL(clicked()),this,convertSlot());
}
...
void TableMyclass::convertSlot()
{
how to check the row?
}
To copy to clipboard, switch view to plain text mode
...
Bookmarks