> Sent: Monday, June 14, 2021 at 1:12 PM
> From: "Scott Bloom" <sc...@towel42.com>
> To: "Thiago Macieira" <thiago.macie...@intel.com>, "interest@qt-project.org" 
> <interest@qt-project.org>
> Subject: Re: [Interest] QNetwork classes for submitting google forms
>
> 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.
> 


You'd probably get feedback that QThread is "too heavy" and for i/o bound 
processes one async event loop is enough. (I've been on the rx end of that)

I think my highest of levels approach is correct:
https://lists.qt-project.org/pipermail/interest/attachments/20210602/9366d8ea/attachment-0001.html
 (apologies for the HTML, but my mailer responds by what ever I am replying to.)

The one caveat to my code, is if you don't need synchronous requests 
(regrettably, this part of my app requires them) then you can ignore the 
QEventloop stuff, that is leave lines that references `loop` it out, and you'll 
have a fully async inline lambda.

You however are asking for a synchronous and this I think is the best way. Feel 
free to assault the code, (Thiago and others.) I would like Qt to adopt some 
kind of this pattern.


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

Reply via email to