I add a context menu to the QTableWidget dynamically:
playlistContenxt = QAction("Add to %s" % (currentItem.text()), self.musicTable)
playlistContenxt.setData(currentData)
self.connect(playlistContenxt, SIGNAL("triggered()"), self.addToPlaylistAction)
self.musicTable.addAction(playlistContenxt)
currentItem.text () is the name of the playlist that is extracted from db, since you can see only one function (addToPlaylistAction), it gets all the triggers from different actions. On my addToPlaylistAction function, how to determine which menu was clicked?
source
share