webview createWindow for javascrip applet
hi i reimpleted the createWindow method of qwebview to add support for javascript applet for my web browser, i also enble the setting javacanopenwindows, this is what i did
QWebView * WebView::createWindow ( QWebPage::WebWindowType type ){
QWidget *view = new QWidget;
QWebView *appletview = new QWebView(view);
appletview = QWebView::createWindow (type );
//appletview->load(appletview->url());
view->show();
}
but whenever a page open a javascript applet, i get two windows that get open, and non of them loads the intended content, please help!
Re: webview createWindow for javascrip applet
They are several errors in the procedure above,
You create two webviews... First in a widget and second by calling parent createWindow(). Use only one of this constructor and "return" the pointer ...
Code:
QWebView * WebView::createWindow ( QWebPage::WebWindowType type ) {
QWebView *appletview = new QWebView(NULL);
// ...
return appletView;
}
Instead of made a show() call in the createWindow function, try to do it on the loadFinished() signal. This reduce flickering of your page when the window open and draw the content of the page...
Code:
:QWebView(parent)
{
hide();
...
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(onPageLoadFinished(bool)));
}
void WebView::onPageLoadFinished(bool value)
{
show();
}
Re: webview createWindow for javascrip applet
many thanks, it works, thanks alot!!!