Showing data on QTableWidget
I have a database table and I must read it and show it on tableWidget
I read it but I cant show it on tableWidget, How开发者_运维技巧 can I do?
Thanks
There is no function biding datable table with QTableWidget. So you must get data from datable and set it on QTableWitget by using QTableWidgetItem. You must set data on QTableWidget's cells manually.
QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(
data);
tableWidget->setItem(row, column, newItem);
Regards!
There is a class which designed to be used with QTableView widget which takes data from the database: http://doc.qt.io/archives/4.6/qsqltablemodel.html
精彩评论