<div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 7, 2015 at 4:11 PM, Ilya Kulakov <span dir="ltr"><<a href="mailto:kulakov.ilya@gmail.com" target="_blank">kulakov.ilya@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a python thread that mainly serves a network connection. In this thread (due to the logic/architecture of my app) I need connect to a slot of QApplication clipboard.<br>
Something straightforward like connect does not work because my thread does not have a Qt event loop. However if I connect with a DirectConnect, I'll get my callback called, but sometimes it simply stops to work: no events are delivered.<br>
<br>
Is there any utility classes in PyQt to subscribe to Qt events from non-Qt threads?<br></blockquote><div><br></div><div>Delivery of signals to an objects slot when the object lives in another thread requires a Qt event loop running in that thread, you won't get around that if you really need a cross-thread signal/slot connection.</div><div><br></div><div>However an alternative is to keep the slot in the main thread and use standard inter-thread communication (Lock/Condition or Queue from python) to signal whatever you need to communicate to the thread.</div><div><br></div><div>Qt and PyQt offer some threading API as well (QThread, QMutex, QSemaphore, QFuture) but I think you'd have to use QThread for those to work correctly for your thread (and it sounds like that is also a significant change in your design).</div><div><br></div><div>Andreas</div></div></div></div>