model
->setHeaderData
(0, Qt
::Horizontal,
QObject::tr("NO."));
model
->setHeaderData
(1, Qt
::Horizontal,
QObject::tr("Source IP"));
model
->setHeaderData
(2, Qt
::Horizontal,
QObject::tr("Destination IP"));
model
->setHeaderData
(3, Qt
::Horizontal,
QObject::tr("Source Port"));
model
->setHeaderData
(4, Qt
::Horizontal,
QObject::tr("Destination Port"));
tablepackets->setModel(model);
//packet_number is Captured data packets number,and will automatically increase...
item
->setText
(QString::number(packet_numer
));
ethmodel->setItem(packet_number,0,item);
//Other captured data is not displayed
.
.
QTreeView* tablepackets=new QTreeView();
QStandardItemModel* model=new QStandardItemModel(0,5,this);
model->setHeaderData(0, Qt::Horizontal, QObject::tr("NO."));
model->setHeaderData(1, Qt::Horizontal, QObject::tr("Source IP"));
model->setHeaderData(2, Qt::Horizontal, QObject::tr("Destination IP"));
model->setHeaderData(3, Qt::Horizontal, QObject::tr("Source Port"));
model->setHeaderData(4, Qt::Horizontal, QObject::tr("Destination Port"));
tablepackets->setModel(model);
QStandardItemModel* ethmodel=(QStandardItemModel*)tablepackets->Model();
//packet_number is Captured data packets number,and will automatically increase...
QStandardItem* item=new QStandardItem();
item->setText(QString::number(packet_numer));
ethmodel->setItem(packet_number,0,item);
//Other captured data is not displayed
ethmodel->setItem(packet_number,1,new QStandardItem(QString("Protocol")));
.
.
ethmodel->setItem(packet_number,4,new QStandardItem(QString("Port")));
To copy to clipboard, switch view to plain text mode
Please help me ....Thank you...
Bookmarks