View Full Version : QTableView without QSqlQueryModel or QSqlTableModel
weaver4
26th February 2010, 23:11
I have some data that is coming in via a TCP/IP connection that I need to show in a QTableView. I don't need to create a DB for the information. What is the best way to show this information in a QTableView if I don't want a DB.
I could show the information in QListView if I could set up Tabs.
Lykurg
26th February 2010, 23:31
If you need a model based approach then write your own model and add the data there. Or just use QTableWidget and add items whenever you receive data.
tsuibin
2nd March 2010, 05:24
QStandardItem *newItem=0;
QStandardItemModel *model = new QStandardItemModel();
for(int row=0; row< datarow.count() ; row++){
for(int col=0; col< datacol.count() ; col++){
newItem = new QStandardItem(yourdata.toString());
model->setItem(row ,col, newItem);
}
row++;
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.