On 8/30/22 00:08, Frank Rueter wrote:
Hi all,


Hey Frank,

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)
*


Just a sanity check:
That's declared inside a class, but not inside any method, right?

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)*

Is this method decorated with a `@Slot(list)` ?

@Slot(list)
def __prep_task_data(elf, 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))
*

This might be due to the lazy registration of the lambda as a Slot,
without properly going through the Slot-registration process.

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

It might be the missing @Slot,
but let me know if that's not the case.

Cheers,
frank


Cheers

--
Dr. Cristián Maureira-Fredes
Senior R&D Manager

The Qt Company GmbH
Erich-Thilo-Str. 10
D-12489 Berlin

Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B
_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to