you should be able to execute your script using QWebFrame::evaluateJavaScript method. See if an example below would work for you:
initializing webview:
QWebView *view = new QWebView(this->centralWidget());
view->load(QUrl("file:///home//test.html"));
connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
loadFinished signal handler:
void MyTestWindow::loadFinished(bool)
{
QVariant f1result = ((QWebView*)sender())->page()->mainFrame()->evaluateJavaScript("f1('test param')");
qDebug() << f1result.toString();
}
test.html:
<head>
<script LANGUAGE="JavaScript">
function f1 (s)
{
alert (s)
return "f1 result"
}
</script>
</head>
<body>
test html
</body>