porting from qtwebkit to qtwebengine

Although this authority document talks about the porting issues arising from transferring from qtwebkit to qtwebengine, there are still a lot more to do to accomplish the porting.

Porting from QWebPage/QWebFrame to QWebEnginePage:

void javaScriptAlert ( QWebFrame * frame, const QString & msg );//QWebPage
void javaScriptAlert ( const QUrl &securityOrigin, const QString & msg );//QWebEnginePage

bool javaScriptConfirm ( QWebFrame * frame, const QString & msg );//QWebPage
bool javaScriptConfirm ( const QUrl &securityOrigin, const QString & msg );//QWebEnginePage

bool javaScriptPrompt ( QWebFrame * frame, const QString & msg, const QString & defaultValue, QString * result );//QWebPage
bool javaScriptPrompt ( const QUrl &securityOrigin, const QString & msg, const QString & defaultValue, QString * result );//QWebEnginePage

//bool shouldInterruptJavaScript (); //removed in QWebEnginePage
//virtual QString userAgentForUrl(const QUrl& url) const;//removed in QWebEnginePage

loadFinished(bool) signal in QWebFrame => loadFinished(bool) in QWebEnginePage

page()->findText("somestring",QWebPage::FindCaseSensitively)

The QNetworkAccessManager class is removed from QtWebEnginePage, which means you cannot intercept the request url by re-implementing the createRequest function of QNetworkAccessManager . QWebEnginePage does not have the setNetworkAccessManager function any more. To intercept a request in QWebEnginePage, you need to get the profile of the webenginepage and call its setRequestInterceptor function to set a request interceptor. In this interceptor, you can re-implement the interceptRequest function to get the url,etc. that is passed as a parameter of this function.  QNetworkAccessManager  was also used to share cookies between web pages. Now you can use QNetworkCookieJar to do the same job.

Posted in

Leave a Reply