为什么我用dataChanged()更新不了视图(新手问题)

mengbuluo1988 mengbuluo1988 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
bool TranscationModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if(index.isValid()&&role==Qt::EditRole)
{
transcationItem* item=currencyList[index.row()];
switch (index.column())
{
case Money:
item->money=value.toString().toDouble();break;
case Time:
item->time=value.toString();break;
case Type:
item->type=value.toString();break;
default:
return false;
}
emit dataChanged(index,index);
return true;
}
return false;
}

我编译后,我的tableView中输入数据,回车后,显示没有改变,但编译的时候,数据已经变了。而且也发射了 信号!!!
求助中。。。。
...全文

相关推荐

评论
收藏 已收藏
分享
返回顶部
mengbuluo1988
Qt 21,503 成员 26,693 内容