If you are using Qt 4.5 do it something like this:
htmlView->page()->mainFrame()->evaluateJavaScript("add_message(); null");
Note: null at the end of script is for performance issue. QWebFrame::evaluateJavaScript returns QVariant with last value in the script. Evaluating last value in the script may be really time consuming, so putting null at the end makes it return immediately.
Kamil Klimek
2009-12-03 14:53:04