Qt tableWidget控件如何将数据打印到相应的列中去
求大神们能给个简单的例子或者推荐点学习资料,我现在在做一个linux下的pcap的抓包工具
我是这样想的,在线程里面传递一些参数过来,然后打印到tableWidget的相应列中,迷茫了。。。 qt 按列输入 QTableWidget
[解决办法]
我这里正好有段示例,是靠网络的ssdp客户端读取信息,显示在tabwidget上,
connect(m_ssdpClient, SIGNAL(newDeviceEvent(QString,QString,QString,QString,QString,QString)),
this, SLOT(recieveNewDeviceEvent(QString,QString,QString,QString,QString,QString)));
void MainWindow::recieveNewDeviceEvent(const QString &usn, const QString &location, const QString &st,
const QString &ext, const QString &server, const QString &cacheControl)
{
Q_UNUSED(st);
Q_UNUSED(ext);
Q_UNUSED(server);
Q_UNUSED(cacheControl);
int row = ui->tableWidget->rowCount();
ui->tableWidget->setRowCount(row+1);
QTableWidgetItem *item = new QTableWidgetItem(usn.toUpper());
Qt::ItemFlags flag = item->flags() &~Qt::ItemIsEditable;
item->setFlags(flag);
ui->tableWidget->setItem(row, UUID_COLUMN, item);
item = new QTableWidgetItem(location);
ui->tableWidget->setItem(row, HOSTNAME_COLUMN, item);
}