Good day all.
I have created a Qtablewidget in qt designer called tab_items.
I then created A Pusg button and added it to the table.
connect(but1, SIGNAL(clicked()),this,SLOT(productSearch()));
ui->tab_items->setCellWidget(0,2,but1);
but1=new QPushButton(QIcon(":/images/icons/search.png"),"",parentWidget());
connect(but1, SIGNAL(clicked()),this,SLOT(productSearch()));
ui->tab_items->setCellWidget(0,2,but1);
To copy to clipboard, switch view to plain text mode
This gives me my search page. Which works great. But as i get more rows in the table i add more buttons. all works fine with more thatn one button.
However i would like to know what row the button is on.
At first i tried this
connect(ui->tab_items, SIGNAL(cellClicked(int,int)), this, SLOT(myCellActivated(int,int)));
connect(ui->tab_items, SIGNAL(cellClicked(int,int)), this, SLOT(myCellActivated(int,int)));
To copy to clipboard, switch view to plain text mode
The above works fine for all the cells exept the one with the widget inserted.
I also tried cellactivated which did not work. So i though it must be because it i s a widget
So i then tried this
...
...}
{
qDebug() << "*DEBUG : Global myrow set to : " << myitem->row();
}
connect(ui->tab_items, SIGNAL(itemActivated(QTableWidgetItem*)), this, {
...
SLOT(myitemClicked(QTableWidgetItem*)));
...}
void frm_tabdemo::myitemClicked(QTableWidgetItem* myitem)
{
qDebug() << "*DEBUG : Global myrow set to : " << myitem->row();
}
To copy to clipboard, switch view to plain text mode
This time "myitemclicked" does not even display.
So with all that i have tried above could someone please tell me how i could get the row of the button that was clicked
Regards
Bookmarks