This has come up a couple times for me through the years (essentially make a 
network request and don’t return until the request has finished).

Is there an example anywhere of the "Thiago" (proper.. 😊 ) way to code this?  I 
see this issue in a similar vane to using QThread, when the Trolls/Nokia/TQP (I 
forget who originally wrote it) wrote up a small but very effective white paper 
on the proper method of using Qthread, it clarified a ton of questions for many 
people.

Scott

-----Original Message-----
From: Interest <interest-boun...@qt-project.org> On Behalf Of Thiago Macieira
Sent: Sunday, June 13, 2021 08:03
To: interest@qt-project.org
Subject: Re: [Interest] QNetwork classes for submitting google forms

On Friday, 11 June 2021 21:05:08 PDT Max Paperno wrote:
> > Insert a "return" here and let your slot be called when the time is right.
> 
> Right, too much Python lately... "should" have been `processEvents()` 
> which is when I realized there were no events to process w/out a Qt 
> loop in the first place.  Returning from main() wouldn't have solved 
> the issue though.

Please do as I said: insert a return and let the event loop handle calling your 
slots.

Nested event loops are an anti-pattern. Don't write code like that unless you 
really must. And if you do, use QEventLoop.

Don't use processEvents(). That's only slightly less evil than sleep().

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to