QRunnable and signals/slots

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

QRunnable and signals/slots

Giuseppe Corbelli
Hi all
I would like to have a generic QRunnable that just references a packaged
task and executes it, without having to subclass everytime and not
considering synchronization issues, but with signals/slots integration.

I found a few references [1] that suggest the straightforward approach
to subclass both QObject and QRunnable (in this order).

The implementation attached looks fine&simple enough to me but somehow
the events are not running, and I cannot see what is wrong. PyQt/Qt
5.10.1 on Debian x86_64, Python 3.6.6

Hope someone wants to have a look, thanks in advance.


[1] https://gist.github.com/paulbarbu/6086849

--
Giuseppe Corbelli

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

Runnable.py (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: QRunnable and signals/slots

Giuseppe Corbelli
On 07/05/2018 06:11 PM, Colin McPhail wrote:
> Hi Giuseppe,
>
> I seem to think I had the same problem once. Here is what I did to get
> round it. There is a separate class for the signals and the QRunnable
> uses an instance of that class for emitting signals....
Thanks Colin
used the same approach to workaround the problem, but I was interested
in understanding what is wrong with the inheritance approach.

--
Giuseppe Corbelli
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: QRunnable and signals/slots

Phil Thompson-5
On 6 Jul 2018, at 8:14 am, Giuseppe Corbelli <[hidden email]> wrote:
>
> On 07/05/2018 06:11 PM, Colin McPhail wrote:
>> Hi Giuseppe,
>>
>> I seem to think I had the same problem once. Here is what I did to get round it. There is a separate class for the signals and the QRunnable uses an instance of that class for emitting signals....
> Thanks Colin
> used the same approach to workaround the problem, but I was interested in understanding what is wrong with the inheritance approach.

http://pyqt.sourceforge.net/Docs/PyQt5/gotchas.html#multiple-inheritance

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: QRunnable and signals/slots

Giuseppe Corbelli
On 07/07/2018 06:26 PM, Phil Thompson wrote:
>>> Hi Giuseppe,
>>>
>>> I seem to think I had the same problem once. Here is what I did to get round it. There is a separate class for the signals and the QRunnable uses an instance of that class for emitting signals....
>> Thanks Colin
>> used the same approach to workaround the problem, but I was interested in understanding what is wrong with the inheritance approach.
>
> http://pyqt.sourceforge.net/Docs/PyQt5/gotchas.html#multiple-inheritance

Should have already known that...

Thanks

--
Giuseppe Corbelli
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt