In my QTableView I have a model MyDataModel that inherits from QAbstractTableModel to which I have added the below method to be able to rename the item by double clicking it!!



Qt Code:
  1. def flags(self, index):
  2. """ This method sets the text in the cell editor selected
  3. and editable and enabled.
  4. """
  5. return QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
To copy to clipboard, switch view to plain text mode 

But now I have also added a right click contextual menu on which i have added the rename option, so I want to trigger the double click behavior to rename the selected item the same way I did by double clicking it.

How can I achieve that?