[Qt-embedded-interest] Generating Javascript events from QtWebKit

Darren New darren.new at prodeasystems.com
Wed Oct 21 22:40:21 CEST 2009


I'm using Qt 4.5.2 to create a web interface for applications on an
embedded MIPS-based box.

 

I have a plug-in working, and I can link a C++ object that controls the
front-panel LEDs into Javascript (via addToJavaScriptWindowObject) , so
I can blink the LED from a web page. That all works great.

 

What I can't seem to find is a mechanism for letting C++ generate an
event at the Javascript level. I would like to be able to generate a
javascript event when (for example) the barometer changes or the quality
of the wifi signal drops. That is, I'd like to generate an arbitrary
javascript event that an HTML/JS application could listen for.

 

The only obvious interface to WebKit from Qt for something like that is
the evaluateJavaScript function, but it seems odd that I would need to
construct a call to create, populate, and dispatch an event by building
a javascript string without support closer to the kind of thing the
addToJSWindowObject supports.

 

Any hints on how to invoke an event from within a C++ Qt application
that'll trigger listeners in WebKit javascript? Also, is that going to
work invoked from a different thread, or must it be some thread
associated with webkit somehow?

 

Thanks in advance for any hints!

--Darren

 




This message is confidential to Prodea Systems, Inc unless otherwise indicated 
or apparent from its nature. This message is directed to the intended recipient 
only, who may be readily determined by the sender of this message and its 
contents. If the reader of this message is not the intended recipient, or an 
employee or agent responsible for delivering this message to the intended 
recipient:(a)any dissemination or copying of this message is strictly 
prohibited; and(b)immediately notify the sender by return message and destroy 
any copies of this message in any form(electronic, paper or otherwise) that you 
have.The delivery of this message and its information is neither intended to be 
nor constitutes a disclosure or waiver of any trade secrets, intellectual 
property, attorney work product, or attorney-client communications. The 
authority of the individual sending this message to legally bind Prodea Systems  
is neither apparent nor implied,and must be independently verified.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-embedded-interest/attachments/20091021/d0a8d1f7/attachment.html 


More information about the Qt-embedded-interest mailing list