开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜