PDA

View Full Version : adding right click to tableview cells



krystosan
4th January 2014, 19:39
I want to have a right click menu from which i can rename, delete or open the selected image in QTableView from cells.

Here is what I have so f

def _connections(self):
self.setContextMenuPolicy(QtCore.Qt.CustomContextM enu)
self.connect(self, QtCore.SIGNAL(self.customContextMenuRequested(QtCo re.QPoint)), self, QtCore.SLOT(displayMenu(QtCore.QPoint)))
if self._slideShowWin:
self._slideShowWin.bar.galrBtn.clicked[bool].connect(self._openSlideShow)

def displayMenu(self, pos):
self.menu = QtGui.QMenu()
self.menu.addAction(self.close)
self.menu.exec_(self.mapToGlobal(event.pos()))



But keep getting the error saying
self.connect(self, QtCore.SIGNAL(self.customContextMenuRequested(QtCo re.QPoint)), self, QtCore.SLOT(displayMenu(QtCore.QPoint)))
TypeError: native Qt signal is not callable

anda_skoa
4th January 2014, 19:58
My guess would be the "self." inside the SIGNAL() is wrong.

Cheers,
_

krystosan
5th January 2014, 05:29
My guess would be the "self." inside the SIGNAL() is wrong.

Cheers,
_

self is my QTableView

anda_skoa
5th January 2014, 12:32
self is my QTableView
Yes it is. How is that related to what I wrote?

Cheers,
_