I'm writing a pyqt5 GUI utility and I'm having problems understanding the "right way" to go about passing additional arguments along with my signal when the signal is already passes an argument of its own.
For instance with Qpushbuttons I have been successful doing this:
self.pushButtonUpdateContentLeft.clicked.connect(lambda:
self.updatecontentlist(
param1,
param2
))
This works fine when calling the function, which is declared as follows:
def updatecontentlist(self, param1, param2):
<code block>
The problem I am encountering is that I now want to connect a "doubleclicked" signal from a QListWidget and that signal also sends a parameter of its own. So this works:
self.contentListWidgetLeft.itemDoubleClicked.connect(self.updatecontentlist)
def updatecontentlist(self, clickeditem):
<code block>
But this doesn't:
self.contentListWidgetLeft.itemDoubleClicked.connect(lambda:
self.updatecontentlist(
param1,
param2))
def updatecontentlist(self, clickeditem, param1, param2):
<code block>
As soon as I try to add extra params using lambda the same way I did for the QPushButton I start getting argument mismatch errors and such. I can't seem to figure out what the proper syntax is to do this, or if it's possible. Can it be done? Is there a better way?
I'm loading my UI straight from .ui files that were created in QTDesigner, if that matters.