使用tableWidget显示问题

Magic_still 2012-12-12 09:48:10
使用tableWidget,
(QList<Rtype> listRt)
Rtype Rtypes;
int nLen=listRt.length();
ui.tableWidget_3->setRowCount(nLen);

for (int i=0;i<nLen;i++)
{
Rtypes=listRt.at(i);
QTableWidgetItem *items=new QTableWidgetItem;
items->setData(0,Rtypes.nindex);
下面类似
}
结果tableWidget显示数据调用一次增加一次。
什么问题啊 ,纠结啊。。
...全文
266 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Magic_still 2012-12-13
  • 打赏
  • 举报
回复
找到问题了,原始调用的缓存变了~~
Magic_still 2012-12-12
  • 打赏
  • 举报
回复
引用 1 楼 jdwx1 的回复:
添加数据之前,有没有clear这个tableWidget?
清了 一样~~·
  • 打赏
  • 举报
回复
我试了一下没问题呀 tw = new QTableWidget(this); tw->setRowCount(5); tw->setColumnCount(1); for(int i=0; i<5; ++i) { QTableWidgetItem* item = new QTableWidgetItem(QString("%1").arg(2*i)); tw->setItem(i, 0, item); }
jdwx 2012-12-12
  • 打赏
  • 举报
回复
添加数据之前,有没有clear这个tableWidget?

16,229

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧