Hi,
Are you have create signal and slot for your QTableWidget in your code ?
you can add this code in your code :
//Create Signal and slot for QTableWidget
connect(ui->tableWidget, SIGNAL(cellChanged ( int, int)), this, SLOT(mycellChanged(int, int)));
//Create Signal and slot for QTableWidget
connect(ui->tableWidget, SIGNAL(cellChanged ( int, int)), this, SLOT(mycellChanged(int, int)));
To copy to clipboard, switch view to plain text mode
and implement mycellChanged slot like this :
//show debug information when QTableWidgetItem Changed
void basicQTableWidget::mycellChanged(int myrow, int mycol)
{
if(celldata->text()!="")
{
qDebug
()<<
"Table Position [" + QString::number(myrow
) + ", " + QString::number(mycol
) + "] = " + celldata
->text
();
}
else
{
qDebug
()<<
"Table Position [" + QString::number(myrow
) + ", " + QString::number(mycol
) + "] is Empty";
}
}
//show debug information when QTableWidgetItem Changed
void basicQTableWidget::mycellChanged(int myrow, int mycol)
{
QTableWidgetItem *celldata = ui->tableWidget->item(myrow, mycol);
if(celldata->text()!="")
{
qDebug()<<"Table Position [" + QString::number(myrow) +
", " + QString::number(mycol) + "] = " + celldata->text();
}
else
{
qDebug()<<"Table Position [" + QString::number(myrow) + ", " +
QString::number(mycol) + "] is Empty";
}
}
To copy to clipboard, switch view to plain text mode
you can get the complete source code in here : http://toto-share.com/2011/11/qt-qtablewidget-tutorial
Are this website address solve your problem ?
Best regards,
Toto
Bookmarks