[PySide] signal connection only works with lambda

Frank Rueter frank at ohufx.com
Tue Aug 30 00:08:07 CEST 2022


Hi all,

probably a pre-coffee hiccup:
I have this weird issue where my signal connection only works when
utilising lambda, even though the data type sent by the signal is exactly
what the receiving slot needs.
This is my code:

In a worker class (QRunnable) I emit this signal

*    tasks_data_available = QtCore.Signal(list)*

In my main widget I connect it like this:

*        worker.tasks_data_available.connect(self.__prep_task_data)*
the slot looks like this:

*    def __prep_task_data(self, task_list):*
*        print(task_list)*

I have done this countless times, but for some reason in this case the code
never calls the slot when the QRunnable emits task_list.

When I do this it works though:

*        worker.tasks_data_available.connect(lambda t:
self.__prep_task_data(t))*

What am I missing? I should not have to use lambda in this case.

Cheers,
frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20220830/ca05ef84/attachment.htm>


More information about the PySide mailing list