如何在 QTableView 中检测双击 [英] How to detect doubleClick in QTableView
本文介绍了如何在 QTableView 中检测双击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 PyQt 创建一个 GUI 应用程序.在继承自 QTableView 的视图中,需要检测用户双击一行时选择的行.该表有排序,但没有编辑.
I'm using PyQt to create a GUI application. In a view inherited from QTableView, need to detect the row the user has selected when they double click a row. The table has sorting, but no editing.
我该怎么做?
注意 - 尝试了 doubleClicked(int) 信号.它是由鼠标按钮发出的,而不是由数据单元发出的,因此它从未被触发.:(
Note - tried the doubleClicked(int) signal. It is emitted by mouse buttons, not by data cells, so it was never fired. :(
伊恩
推荐答案
我不明白.QTableView的doubleClicked信号有签名
I dont understand. The doubleClicked signal of the QTableView has the signature
void doubleClicked ( const QModelIndex & index )
如果您连接该信号,您应该获得正确的 QModelIndex.
If you connect that signal you should obtain the correct QModelIndex.
这篇关于如何在 QTableView 中检测双击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文