Search code examples
qtqt4pyqt

How to detect doubleClick in 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.

How do I do it?

Note - tried the doubleClicked(int) signal. It is emitted by mouse buttons, not by data cells, so it was never fired. :(

Ian


Solution

  • I dont understand. The doubleClicked signal of the QTableView has the signature

    void doubleClicked ( const QModelIndex & index )
    

    If you connect that signal you should obtain the correct QModelIndex.