[Interest] QWebEngine: Http POST request with payload data

Konstantin Tokarev annulen at yandex.ru
Mon Mar 6 16:52:54 CET 2017



06.03.2017, 17:34, "Jason Dolan" <jason at pcc.com>:
> Ahh, of coarse there is a solution in the *next* release.  I feel like that’s always the case with QWebEngine since Qt 5.0.  Well, I guess it takes a while for it to become a full fledged replacement for QWebkit.

Note that you have an option to use QtWebKit if you want to.

http://qtwebkit.blogspot.com/2016/08/qtwebkit-im-back.html

>
> Guess I’ll go the Javascript route until we migrate to Qt 5.9.
>
> Thanks!
>> On Mar 6, 2017, at 2:09 AM, Kai Koehne <Kai.Koehne at qt.io> wrote:
>>
>>> Does anyone know of the best way to make a HTTP Post request with payload data using QWebEngine?
>>
>> There's new API for this in upcoming Qt 5.9:
>>
>> https://codereview.qt-project.org/#/c/167422/23/
>>
>>> The only possible solution I’ve found so far includes generating some javascript to create the POST request and then issuing that with QWebEnginePage::runJavaScript…
>>
>> Indeed, generating a XMLHttpRequest from JS should work, too.
>>
>> Regards
>>
>> Kai
>> ----------------------------------------
>> From: Interest <interest-bounces+kai.koehne=qt.io at qt-project.org> on behalf of Jason Dolan <jason at pcc.com>
>> Sent: Sunday, March 5, 2017 7:17:36 PM
>> To: interest at qt-project.org
>> Subject: [Interest] QWebEngine: Http POST request with payload data
>>
>> Does anyone know of the best way to make a HTTP Post request with payload data using QWebEngine?
>>
>> In Qt4, you would do something like:
>>
>> QNetworkRequest request(url);
>>
>> request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
>>
>> webView->load(request, QNetworkAccessManager::PostOperation, payloadList.join("&").toLatin1());
>>
>> QWebEngineView (or related classes) do not seem to have a way to do this.
>>
>> The only possible solution I’ve found so far includes generating some javascript to create the POST request and then issuing that with QWebEnginePage::runJavaScript…
>>
>> Does anyone have any better ideas?
>>
>> Thanks!
>>
>> -Jason
> ,
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


-- 
Regards,
Konstantin



More information about the Interest mailing list