In my project, I have a QWebView that loads a page that opens a pop-up window. But the window won't open. I looked into the createWindow function but I have no clue how to subclass a widget. These are some settings I put onto the webView:
QWebSettings *settings = ui->webView_2->settings();
settings->setAttribute(QWebSettings::JavascriptEnabled, true);
settings->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
What is the easiest way to allow my webView to allow pop-up windows?
Thanks for your time :)
You need to reimplement QWebView's createWindow method. The QWebView returned will be set to the required URL automatically.
For example:
Keep in mind that cookies do not share between the two QWebViews, so you also need to implement your own cookie manager. One way to do it would be to inherit QNetworkCookieJar, and keep a static "global" instance.