其实,用view是model-view的设计模式。熟练了还是很不错的。
给你个思路,首先你得连接一个信号,自己写个slot来处理这个信号。比较合适的信号是
void QAbstractItemModel::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) [signal]
在你的slot里边先判断这个信号来自第几列的item
如果是第一列的,那么你就做出反应,否则直接返回。
怎么反应呢?如果topLeft.column() == 1 and bottomRight.column() == 1
then 修改第二列相应数据 setData()