Important: Please read the Qt Code of Conduct -

QtWebEngine : Load URL with HTTPPost

  • I'm porting an internal browser from QtWebKit to QtWebEngine.

    I want a function to request url while posting some data.
    With WebKit, I could use the following:

    With class WebView derived from QtWebView :

    void WebView::loadPostUrl(const QUrl &url, QByteArray postdata)
    	m_initialUrl = url;
    	QNetworkRequest request = QNetworkRequest(url);
    	request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    	load(request, QNetworkAccessManager::PostOperation, postdata);

    Since QtWebEngine does interact with QNetworkAccessManager how can we have the same functionalities with QtWebEngine ?


Log in to reply