[Interest] Using QNAM from threads
Konrad Rosenbaum
konrad at silmor.de
Wed Jan 29 18:24:10 CET 2014
On Wednesday, Wednesday 29 January 2014 at 16:27, Philipp Kursawe wrote:
> I have the following problem. I want to have only one QNAM in the (heavily
> plugin based) app.
>
> So I create one QNAM in the main thread when the app starts and assign it
> to the qApp->setProperty("qnam").
>
> Now I have several threads that can run in the background and once in a
> while need network access and process the (big) results. Naturally the
> processing of this big data set cannot be done on the main thread, that
> also runs the UI. So I have to use threads to keep the UI fast and
> responsive.
If your only reason for using threads is to offload processing of the results,
you might as well do all the network handling in the main thread and just
offload the processing of the results once you have them.
> But it seems to be impossible to connect a slot from a thread to a signal
> of the QNAM created QNetworkReply object.
This should not be a problem. You can connect signals and slots across thread
boundaries without problems. What specifically is going wrong for you? Do you
have trouble handing over the QNetworkReply?
BTW: if you have to handle authenticationRequired or sslErrors signals across
threads you need to use a Qt:BlockingConnection.
Konrad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140129/8179d0c0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140129/8179d0c0/attachment.sig>
More information about the Interest
mailing list