[Qt-interest] Qt Webkit and Google Earth Plugin?
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Thu May 20 17:29:45 CEST 2010
Harish Surana wrote on Thursday, May 20, 2010 3:05 PM:
> Please look at
> http://blog.forwardbias.in/2009/12/flash-in-qgraphicsview.html . It
> might help.
Thanks, very interesting article - though I still do not understand where Qt/WebKit is looking for its plugins (in what folders).
Anyway, just for the record: when I browsed to http://code.google.com/intl/de-DE/apis/earth/ with QWebView on my Mac I indeed got a different image: "Click here to download plugin" :) (even though nothing happened when I clicked on it, at least with my simple "SuperBrowser" consisting of a QMainWindow with a QWebView in it, and an "Open URL" menu ;) I did not have time to try with the Qt demo browser or even with Safari...
But the major message here is that Google recognises Qt/WebKit on Mac as being supported, whereas it rejects it on Windows. So my hope is that - assuming the Google Earth plugin works on Mac/Qt/WebKit - it could also be made working on Windows, e.g. by simply faking the "browser ID" or whatever?
On the other hand the first URL given indicates that plugin development is pretty hairy and platform-dependent. But then again, doesn't use Google Chrome also (some flavour of) Webkit? And Chrome on Windows is also supported by Google Earth Plugin (well, what a surprise ;)
My ultimate goal would be to implement a "photo tagger", where I could say "Get current location from Google Earth and store it into the EXIF data of the JPEG". It would be nice to integrate the Google Earth Plugin into the actual Qt application (using QWebView) and interact with it with the JavaScript API somehow. I guess that should be possible from within the C++ world, using something like a class from QtScript?
So if I had a Html page with the Google Earth Plugin embedded and a JavaScript method "getView" defined therein (in the HTML) which would return the current view, as in http://code.google.com/intl/de-DE/apis/earth/documentation/camera_control.html#current_view: How would I invoke such a JavaScript method from the C++ world? Would I navigate the HTLM DOM tree (starting with something like http://doc.trolltech.com/4.6/qwebframe.html#findFirstElement), until I would find the proper JavaScript node and then somehow "execute" that node (using http://doc.trolltech.com/4.6/qscriptengine.html#evaluate maybe) and then convert the returned value with http://doc.trolltech.com/4.6/scripting.html#conversion-between-qtscript-and-c-types? But I can't just call/evaluate
// Google Earth API JavaScript
var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
because the variable 'ge' would not be known to the QScriptEngine, would it? So I would need to "call a JavaScript function inside a HTML page", just as when I would define a HTML button with an "onclick" action (to execute a certain JavaScript function). Is that possible with QtScript/QScriptEngine/QWebView/.../QWebElement?
The Qt script examples all seem to operate on given example.js (script only) JavaScript code, but not on "JavaScript within a web page". Sorry if these are all total noob questions, but this is my first 30 minutes touch with QtScript!
Thank you,
Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list