QWebView, how to handle with JS events?
-
Hi,
Yes, it is possible to make own object and to allow interaction with local application.
If you are going to use WebKit1 then in QWebFrame there is a signal to which you should connect your slot. In this slot you should add your objects that you wish to be visible within web page."QWebFrame":http://doc.qt.nokia.com/4.7-snapshot/qwebframe.html#javaScriptWindowObjectCleared
In case of WebKit2 I am do not know if similar mechanism exists.
-
I don't know which version I'm using...
I'm trying this code:
@
QWebFrame* frame = ui->webView->page()->mainFrame();
frame.addToJavaScriptWindowObject("sender", this);
@Erro:
@
mainwindow.cpp:13:11: error: request for member 'addToJavaScriptWindowObject' in 'frame', which is of non-class type 'QWebFrame*'
@ -
I'm using Qt 4.7, so Webkit1.
@
QWebView* qWebView = ui->webView;
QWebPage* qWebPage = qWebView->page();
QWebFrame* qWebFrame = qWebPage->mainFrame();
@I can't access the methods of qWebFrame object!
And the "QWebFrame" has the method that I want to access:@
void addToJavaScriptWindowObject ( const QString & name, QObject * object )
@