I've been searching for this issue on the internet, but I didn't found an answer. My problem is that I am creating multiple QAction that I store in a list, but I can't seem to connect them with their triggered slot:
def refresh_research_menu(self):
self.action_research = []
self.action_research.append(qtw.QAction("Research", self))
self.action_research[-1].setShortcut("Ctrl+R")
self.action_research[-1].triggered.connect(self.get_research)
for mat in myList:
self.action_research.append(qtw.QAction(mat))
self.action_research[1].triggered.connect(lambda : self.mySlot(MyList[1])) #Problem here
myMenu[1].addAction(self.action_research[-1])
Now, when I compile my code, I only get the last iteration (myList[-1]), so each action of the menu is connected to self.mySlot(myList[-1])
which is my issue.
Thanks!