读书人

Qt tableview的用法有关问题

发布时间: 2012-04-05 12:42:40 作者: rapoo

Qt tableview的用法问题
在窗口中用到tableview控件,要怎么写槽使它能够响应双击某个单元格时获取该单元格的索引及内容,要是能给个完整的例子就最好了,在这先谢过了哈!!!

[解决办法]
void QAbstractItemView::doubleClicked ( const QModelIndex & index ) [signal]

关联这个signal

int QModelIndex::column () const
Returns the column this model index refers to.

int QModelIndex::row () const
Returns the row this model index refers to.
再由上面这两个函数得到 item所在行与列, 这样就能定位到 item 并得处理它的内容。

读书人网 >C++

热点推荐