I am trying to disable a default context menu of QTableView in pyqt.
I have re-implemented the contextMenuEvent but it works on 1st time right click. When I click on the same Item 2nd time the default context menu reappears. (Image attached below for referance.)
I tried "QTableView.setContextMenuPolicy(Qt.NoContextMenu)" but it didn't work. Also referred the answers of similar type questions but still the issue is unresolved.
Any idea?
Ex. showing Re-implemented context menu in QTableView.
def contextMenuEvent(self, event):
menu = QMenu(self)
CutAction = QAction(self.view)
CutAction.setText("&Cut")
menu.addAction(CutAction)
CutAction.setIcon(QIcon(":/{0}.png".format("Cut")))
CutAction.setShortcut("Ctrl+X")
self.connect(CutAction, SIGNAL("triggered()"), self.cut)
