A list for the developers of CellML tools

Text archives Help


[cellml-dev] SVG, JavaScript and OpenCell


Chronological Thread 
  • From: aree035 at aucklanduni.ac.nz (Adam Reeve)
  • Subject: [cellml-dev] SVG, JavaScript and OpenCell
  • Date: Thu, 1 Apr 2010 09:39:42 +1300

Hi Randall

I don't know that Qt/C++ should be discounted so quickly. I've had a
quick search for using SVG + Javascript with Qt and it seems like
there's good support for it.

An example of KDE's use of SVG:
http://www.svgopen.org/2008/papers/104-SVG_in_KDE/

Looking at the QtWebkit documentation it also looks like there's good
support for SVG: http://qt.nokia.com/doc/4.6/webintegration.html

I'm not that familiar with how OpenCell uses Javascript but this
sounds like the kind of thing that's needed:

"QtWebKit provides facilities for rendering of HyperText Markup
Language (HTML), Extensible HyperText Markup Language (XHTML) and
Scalable Vector Graphics (SVG) documents, styled using Cascading Style
Sheets (CSS) and scripted with JavaScript.
A bridge between the JavaScript execution environment and the Qt
object model makes it possible for custom QObjects to be scripted."

This seems like a way we could connect Javascript from an SVG to
objects in the Qt application:

void QWebFrame::addToJavaScriptWindowObject ( const QString & name,
QObject * object )
Make object available under name from within the frame's JavaScript
context. The object will be inserted as a child of the frame's window
object.
Qt properties will be exposed as JavaScript properties and slots as
JavaScript methods.
If you want to ensure that your QObjects remain accessible after
loading a new URL, you should add them in a slot connected to the
javaScriptWindowObjectCleared() signal.
If Javascript is not enabled for this page, then this method does nothing.
The object will never be explicitly deleted by QtWebKit.

There's an example of its use here: http://www.kdedevelopers.org/node/4008

Thanks,
Adam

On 1 April 2010 08:56, David Nickerson <david.nickerson at gmail.com> wrote:
> one question, why do you want to stick to SVG with embedded JavaScript?
>
> On Thu, Apr 1, 2010 at 8:51 AM, Randall Britten
> <r.britten at auckland.ac.nz> wrote:
>> Hi
>>
>>
>>
>> OpenCell is currently based on XulRunner (i.e. very similar to Firefox),
>> and
>> hence cruises regarding handling SVG with JavaScript.? Based on early
>> reports from Alan and Andrew, it seems that other platforms (e.g. Qt/C++ or
>> Scala/JVM) will probably struggle.
>>
>>
>>
>> However, one option to consider is to reverse the situation, and rather
>> than
>> embed the browser in OpenCell, embed OpenCell in the browser.? That way,
>> the
>> SVG is rendered by the browser, and the JavaScript is making calls to and
>> API exposed by the OpenCell plug-in (or applet?).
>>
>>
>>
>> Thoughts?
>>
>>
>>
>> Regards,
>>
>> Randall
>>
>> _______________________________________________
>> cellml-tools-developers mailing list
>> cellml-tools-developers at cellml.org
>> http://www.cellml.org/mailman/listinfo/cellml-tools-developers
>>
>>
> _______________________________________________
> cellml-tools-developers mailing list
> cellml-tools-developers at cellml.org
> http://www.cellml.org/mailman/listinfo/cellml-tools-developers
>




Archive powered by MHonArc 2.6.18.

Top of page