Re: [Interest] QNetwork classes for submitting google forms

2021-06-14 Thread Jason H
> Sent: Monday, June 14, 2021 at 2:07 PM > From: "Jason H" > To: "Jason H" > Cc: "Scott Bloom" , "Thiago Macieira" > , "interest@qt-project.org" > > Subject: Re: [Interest] QNetwork classes for submitting google form

Re: [Interest] QNetwork classes for submitting google forms

2021-06-14 Thread Jason H
> Sent: Monday, June 14, 2021 at 1:42 PM > From: "Jason H" > To: "Scott Bloom" > Cc: "Thiago Macieira" , "interest@qt-project.org" > > Subject: Re: [Interest] QNetwork classes for submitting google forms > > > > &g

Re: [Interest] QNetwork classes for submitting google forms

2021-06-14 Thread Jason H
> Sent: Monday, June 14, 2021 at 1:12 PM > From: "Scott Bloom" > To: "Thiago Macieira" , "interest@qt-project.org" > > Subject: Re: [Interest] QNetwork classes for submitting google forms > > This has come up a couple times for me through t

Re: [Interest] QNetwork classes for submitting google forms

2021-06-14 Thread Scott Bloom
1 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... &

Re: [Interest] QNetwork classes for submitting google forms

2021-06-14 Thread Thiago Macieira
On Sunday, 13 June 2021 12:23:58 PDT Max Paperno wrote: > 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. I said

Re: [Interest] QNetwork classes for submitting google forms

2021-06-14 Thread Jason H
> Sent: Monday, June 14, 2021 at 10:36 AM > From: "Jason H" > To: "Max Paperno" > Cc: interest@qt-project.org > Subject: Re: [Interest] QNetwork classes for submitting google forms > > You might want to look at my pos on Jun 2 "Re: [Interest] QNetw

Re: [Interest] QNetwork classes for submitting google forms

2021-06-14 Thread Jason H
.org > Subject: Re: [Interest] QNetwork classes for submitting google forms > > Ah yeah, it would help a lot to have a Qt event loop to actually deliver > the signals... silly me. Also forgot to delete the reply as per docs. > > Tested, works: > > > int

Re: [Interest] QNetwork classes for submitting google forms

2021-06-13 Thread Max Paperno
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 M

Re: [Interest] QNetwork classes for submitting google forms

2021-06-13 Thread Thiago Macieira
On Sunday, 13 June 2021 08:23:30 PDT Max Paperno wrote: > > Please do as I said: insert a return and let the event loop handle calling > > your slots. > > Did you even look at the (bad) code in question? There was no event loop > and nothing to return from except main(). That was a toy example ap

Re: [Interest] QNetwork classes for submitting google forms

2021-06-13 Thread Max Paperno
On 6/13/2021 11:02 AM, Thiago Macieira wrote: 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

Re: [Interest] QNetwork classes for submitting google forms

2021-06-13 Thread Thiago Macieira
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

Re: [Interest] QNetwork classes for submitting google forms

2021-06-12 Thread Max Paperno
On 6/12/2021 1:29 PM, Nicholas Yue wrote: I have now moved the code into a small UI test app so there is already a Qt loop in the main app but it stopped working (status code not printed out) again, do I have to retain the app.exec() and app.exit() ? Probably because your networkManager goes

Re: [Interest] QNetwork classes for submitting google forms

2021-06-12 Thread Nicholas Yue
I figured it out, QNetworkAccessManager networkManager; needs to be a member of the class (not within the doSubmit() method), otherwise it would have gone out of scope before the reply returns Cheers On Sat, 12 Jun 2021 at 10:29, Nicholas Yue wrote: > I have now moved the code int

Re: [Interest] QNetwork classes for submitting google forms

2021-06-12 Thread Nicholas Yue
I have now moved the code into a small UI test app so there is already a Qt loop in the main app but it stopped working (status code not printed out) again, do I have to retain the app.exec() and app.exit() ? ``` #include "GForm.h" #include "ui_form.h" #include #include #include #include

Re: [Interest] QNetwork classes for submitting google forms

2021-06-11 Thread Max Paperno
On 6/11/2021 10:32 PM, Thiago Macieira wrote: On Friday, 11 June 2021 14:10:57 PDT Max Paperno wrote: while (!gotResponse) sleep(1) // or whatever sleep method, just waiting for a response. NEVER EVER sleep. Insert a "return" here and let your slot be called when the time is right. R

Re: [Interest] QNetwork classes for submitting google forms

2021-06-11 Thread Thiago Macieira
On Friday, 11 June 2021 14:10:57 PDT Max Paperno wrote: > while (!gotResponse) >sleep(1) // or whatever sleep method, just waiting for a response. NEVER EVER sleep. Insert a "return" here and let your slot be called when the time is right. -- Thiago Macieira - thiago.macieira (AT) intel.co

Re: [Interest] QNetwork classes for submitting google forms

2021-06-11 Thread Max Paperno
Ah yeah, it would help a lot to have a Qt event loop to actually deliver the signals... silly me. Also forgot to delete the reply as per docs. Tested, works: int main(int argc, char**argv) {   QCoreApplication app(argc, argv);   QUrlQuery postData;   postData.addQueryItem("entr

Re: [Interest] QNetwork classes for submitting google forms

2021-06-11 Thread Nicholas Yue
``` int main() { QUrlQuery postData; postData.addQueryItem("emailAddress", "abc@gmail.com"); postData.addQueryItem("entry.2020959411", "Qt Query"); QUrl serviceUrl("https://docs.google.com/forms/d/152CTd4VY9pRvLfeACOf6SmmtFAp1CL750Sx72Rh6HJ8/formResponse";); QNetwo

Re: [Interest] QNetwork classes for submitting google forms

2021-06-11 Thread Max Paperno
QObject::connect(&networkManager, &networkManager::finished, ... Whoops, should really be QObject::connect(&networkManager, &QNetworkAccessManager::finished, ... -Max ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/lis

Re: [Interest] QNetwork classes for submitting google forms

2021-06-11 Thread Max Paperno
Hello Nicholas, I would like to know if I am using the Qt QNetwork classes correctly to submit a post to a URL that is a Google form From the docs[1]: QNetworkAccessManager has an asynchronous API. That means you have to wait for a finished() signal before trying to determine the status or r

[Interest] QNetwork classes for submitting google forms

2021-06-11 Thread Nicholas Yue
Hi, I am trying to submit google forms programmatically via C++ and Qt classes I am basing my study on the following https://stackoverflow.com/questions/17964429/google-forms-response-with-python#17965510 I got the Python version running and returned a 200 response. I tried converting the code