PDA

View Full Version : How to activate form buttons in a QWebPage



redneon
28th April 2009, 11:02
I've loaded a webpage in QT using a QWebPage object and its mainFrame()->load() function. On this webpage there's a form with two buttons, an ok button and a cancel button. I'm wanting to be able to activate either button but, browsing the docs, I can't figure out how to do it.

I've spotted the triggerAction() function but there doesn't seem to be a relevant item in the WebAction enum. I've also spotted the NavigationType enum which contains an NavigationTypeFormSubmitted item but that seems to only be used, after an event has been triggered, by the acceptNavigationRequest() function.

wysota
28th April 2009, 14:10
You can do it via javascript. Until now this is the only way to manipulate the contents of a webpage using QtWebKit.

redneon
28th April 2009, 16:07
You can do it via javascript. Until now this is the only way to manipulate the contents of a webpage using QtWebKit.

Are there any examples of using javascript on QWebPage objects?

wysota
28th April 2009, 16:39
Yes, you can find them on labs.qtsoftware.com
But you can also see docs of QWebFrame and its QWebFrame::evaluateJavaScript method.

redneon
28th April 2009, 16:58
Excellent, thanks. I'll check them out.