Wednesday, June 24, 2009

QtWebkit HTML5 practice

At phosphorescence: QtWebKit practice and phosphorescence: QtWebkit practice with QtRuby, I wrote QtWebKit sample program with Qt and QtRuby. And I also mentioned QtWebkit suports HTML5 in the phosphorescence: HTML5 support in QtWebkit. Then, can HTML5 be rendered with QtWebKit?

First, access to the HTML5 demo: Canvas | Drawing Board by Qt program.
#include <QApplication>
#include <QUrl>
#include <QWebView>
int main(int argc, char *argv[]){
QApplication a(argc, argv);
QUrl url("");
QWebView* webView = new QWebView();
return a.exec();

This runs successfully:
and can draw lines in canvas by mouse successfully, too.

Second, access to the HTML5 demo: Canvas | 1st-Person Gifter by QtRuby program.
require 'Qt4'
require 'qtwebkit' do do

Of course. this runs successfully too and move in maze with arrow keys:

Note that canvas tag is rendered easily, but that video tag depends on environment like video format and codec in client. At least, in my environment (on openSUSE 11.1), video tag isn't rendered not only with QtWebkit but also with HTML5 support browsers(Firefox, Opera, Konqueror).

No comments:

Post a Comment