Hi Jacek,
Here is the snippet of code , creating a table and reading data. Correct me if anything wrong in it.
function(eguiMsgData *eguiTxMsg)
{
tableWidget_TxPathHistory->setRowCount(totalpathnum);
tableWidget_TxPathHistory->setColumnCount(6);
tableWidget_TxPathHistory
->setHorizontalHeaderLabels
(QStringList() << tr
("delta1") << tr("delta2") << tr("delta3") << tr("delta4") << tr("PosErr") << tr("Valid"));
tableWidget_TxPathHistory->resizeColumnsToContents();
for(column = 0; column < 6; column++)
{
for (row = 0; row < ; row++)
{
Txdelta1->setFlags(~Qt::ItemIsSelectable | ~Qt::ItemIsEnabled);
Txdelta1->setFlags(Txdelta1->flags() & ~Qt::ItemIsEditable);
Txdelta1->setText(Q_TxPathHistorydelta1.setNum(eguiTxMsg->pathHistoryList[row].delta1,'g',6));
tableWidget_TxPathHistory->setItem(row, column, Txdelta1);
Txdelta2->setFlags(~Qt::ItemIsSelectable | ~ Qt::ItemIsEnabled);
Txdelta2->setFlags(Txdelta2->flags() &~ Qt::ItemIsEditable);
Txdelta2->setText(Q_TxPathHistorydelta2.setNum(eguiTxMsg->pathHistoryList[row].delta2,'g',6));
tableWidget_TxPathHistory->setItem(row, column, Txdelta2);
.....
.....
(Similarly for other 4 columns.)
}
}
tableWidget_TxPathHistory
->setEditTriggers
(QTableWidget::NoEditTriggers);
}
function(eguiMsgData *eguiTxMsg)
{
tableWidget_TxPathHistory->setRowCount(totalpathnum);
tableWidget_TxPathHistory->setColumnCount(6);
tableWidget_TxPathHistory->setHorizontalHeaderLabels(QStringList() << tr("delta1")
<< tr("delta2") << tr("delta3") << tr("delta4") << tr("PosErr") << tr("Valid"));
tableWidget_TxPathHistory->resizeColumnsToContents();
for(column = 0; column < 6; column++)
{
for (row = 0; row < ; row++)
{
QTableWidgetItem *Txdelta1 = new QTableWidgetItem();
Txdelta1->setFlags(~Qt::ItemIsSelectable | ~Qt::ItemIsEnabled);
Txdelta1->setFlags(Txdelta1->flags() & ~Qt::ItemIsEditable);
Txdelta1->setText(Q_TxPathHistorydelta1.setNum(eguiTxMsg->pathHistoryList[row].delta1,'g',6));
tableWidget_TxPathHistory->setItem(row, column, Txdelta1);
QTableWidgetItem *Txdelta2 = new QTableWidgetItem();
Txdelta2->setFlags(~Qt::ItemIsSelectable | ~ Qt::ItemIsEnabled);
Txdelta2->setFlags(Txdelta2->flags() &~ Qt::ItemIsEditable);
Txdelta2->setText(Q_TxPathHistorydelta2.setNum(eguiTxMsg->pathHistoryList[row].delta2,'g',6));
tableWidget_TxPathHistory->setItem(row, column, Txdelta2);
.....
.....
(Similarly for other 4 columns.)
}
}
tableWidget_TxPathHistory->setEditTriggers(QTableWidget::NoEditTriggers);
}
To copy to clipboard, switch view to plain text mode
Thanks & Regards,
Arun
Bookmarks