[Interest] QNetwork classes for submitting google forms

Max Paperno max-l at wdg.us
Sun Jun 13 21:23:58 CEST 2021

On 6/13/2021 1:08 PM, Thiago Macieira wrote:
> That was a toy example application. Most applications will post in event to
> something happening, so the event loop has already started.

But we weren't discussing "most applications."  The OP asked how to 
handle a network request and presented an MRE.  Or are you saying I 
should have written a full app for them?  Are you like this on 
StackOverflow also?

> In the particular you need app.exec().

You mean like my second working example? I appreciate your pointing out 
my mistake (several hours after I corrected it) and the general warning 
about sleeping, but now the horse is already dead.

>>> Don't use processEvents(). That's only slightly less evil than sleep().
>> Maybe you could expand on that further instead of just making blanket
>> statements?  Reference?
> The reference is the source code.

Huh? In the source code somewhere it says "don't use processEvents()?" 
Seems maybe that belongs in the docs... :)  I understand what it means 
to read the source to see how something works, but I'm not sure how that 
applies here.

> QEventLoop calls processEvents for you, but it also reacts to quit() and other
> event-interruption mechanisms, as well as interrupt-prevention mechanisms. If
> you call processEvents() on your own, you have to provide your own mechanism.
> Many an application got stuck calling processEvents() after being asked to
> exit that loop.
> If you think you need to exclude UI events, you're wrong.
> If you think you want to process a limited number of events (especially "just
> one"), you're wrong.

Thanks for elaborating. So the actual answer/advice is to use 
processEvents() _correctly_ (or QEventLoop which "autmagically" does the 
"right thing" for you... read its the code to see what that is). Which 
is certainly a valid point.  I will amend any future mention if it with 
a big *"when used correctly" footnote instead of assuming that someone 
would already do that in the first place.

Is the condescending tone really necessary to get your point across?


More information about the Interest mailing list