为什么我用dataChanged()更新不了视图(新手问题)
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中输入数据,回车后,显示没有改变,但编译的时候,数据已经变了。而且也发射了 信号!!!
求助中。。。。