[PyQt] How to get Qt signals delivered to a pure python thread.

Giuseppe Corbelli giuseppe.corbelli at copanitalia.com
Thu Jan 8 10:51:21 GMT 2015


On 08/01/2015 11:25, Ilya Kulakov wrote:
> processEvents has an overload with a maxTime argument, isn't that
>> exactly what Ilya is looking for?
>>
>>    Process pending events that match flags for a maximum of maxTime
>>    milliseconds, or until there are no more events to process,
>>    whichever is shorter.
>>
>> http://doc.qt.io/qt-5/qeventloop.html#processEvents-2
>
> Unfortunately it does not work as expected. processEvents should be running
> _within_ qeventloop. As I understand it's designed to process events during
> some long term task which do not return execution.
> But it requires a blocking qeventloop.exec in the first place which I cannot
> afford to have.
>
> What I'm looking for, is something like qeventloop.exec(10ms).

Don't understand what "within qeventloop" means. You can create an eventloop 
and call processEvents repeatedly instead of exec_().
If you look at qeventloop.cpp QT sources you can see that exec() is based on a
while (!d->exit)
   processEvents(flags | WaitForMoreEvents | EventLoopExec);

-- 
             Giuseppe Corbelli
WASP Software Engineer, Copan Italia S.p.A
Phone: +390303666318  Fax: +390302659932
E-mail: giuseppe.corbelli at copanitalia.com


More information about the PyQt mailing list