• All User Interface and Application logic is coded in JS • Extra functionality is provided in C++ Qt C++ (Native Code) HTML/JS/CSS Tuesday, February 14, 2012
from the Qt wrapper application • Calling methods on this object leads to execution of code in C++ • Defaults to single-threaded Tuesday, February 14, 2012
and edit web documents • QWebFrame is a QObject representing a frame or iframe in a page • QWebView is a QWidget capable of displaying QWebPage Tuesday, February 14, 2012
invoked from JS • Can use Q_INVOKABLE to define an invokable method class Zombie : public QObject { Q_OBJECT public: Q_INVOKABLE void eatBrain(); Q_INVOKABLE int attack(); void rest(); public slots: void walk(QString where); }; Tuesday, February 14, 2012
page and named Zombie • Arguments must match class Zombie : public QObject { Q_OBJECT signals: void scream(int volume); }; function freeze_in_panic(volume) { // Oh no it’s the end-of-the-world } Zombie.scream.connect(freeze_in_panic); Tuesday, February 14, 2012
to a JS object similar to the right • Can send img element from web to native { width: ..., height: ..., toDataURL: function() { ... }, assignToHTMLImageElement: function(element) { ... } } Tuesday, February 14, 2012