tags:

views:

119

answers:

1

Hello,

I'm going to collecect form inputs on web pages to fill them next time automatically based on input field name.

How to pass selected/howered HTML element data in QtWebkit to qt application? Like Firebug does.

Qt version: 4.6 / 4.7

Thanks.

+2  A: 

Add some JavaScript to assign a unique ID or class to the element below the mouse pointer and then use the standard selectors with the QWebFrame to locate it.

A more simple solution might be the selector ":hover" but that will give you a whole bunch of elements which you need to filter because the mouse always hovers over HTML and BODY and all the other elements which are stacked upon each other below your mouse. So if the mouse is over a span in a paragraph, you will get at least HTML, BODY, P, SPAN.

Aaron Digulla
Aaron, can you please, provide some examples or points to docs how to assign unique ID to the element below the mouse pointer or how to use :hower selecter in QtWebkit? Thanks.
found it: QWebFrame *frame = ui.webView->page()->mainFrame(); QWebElement firstName = frame->findFirstElement("...."); Now checking for mouse over event, and integration JS with Qt app