• 5327阅读
  • 3回复

[提问]QTableView中如何获取单击单元格信号!!! [复制链接]

上一主题 下一主题
离线nuanbing222
 

只看楼主 倒序阅读 楼主  发表于: 2014-08-28
RT,想在使用QTableView显示自定义的model,但是需要获取一个鼠标单击第一列单元格的信号,我试了一下mousePressEvent,但是发现这个鼠标单击事件是对整个QTableView有效的,如果已经选择了第一列的某个单元格,再单击空白区域时,也会发出信号。另外,还试了一下selectionChanged函数,发现只能在单元格选择改变时有效,如果我连续单击第一列的某个单元格就不会重复发出信号了。。。

大神们,有没有其它的办法啊?!!!
离线nuanbing222

只看该作者 1楼 发表于: 2014-08-28
没有人知道吗?急!!!!在线等。。。
离线chinkyy

只看该作者 2楼 发表于: 2014-08-28
void QAbstractItemView::clicked ( const QModelIndex & index ) [signal]

  This signal is emitted when a mouse button is clicked. The item the mouse was clicked on is specified by index. The signal is only emitted when the index is valid.
离线nuanbing222

只看该作者 3楼 发表于: 2014-08-29
回 chinkyy 的帖子
chinkyy:void QAbstractItemView::clicked ( const QModelIndex & index ) [signal]
  This signal is emitted when a mouse button is clicked. The item the mouse was clicked on is specified by index. The signal is only emitted when the index is valid.
 (2014-08-28 18:09) 

试过了,OK,非常感谢
快速回复
限100 字节
 
上一个 下一个