QMLPart: enabling a declarative web

As some of you already know, I started last year with some university friend Wadobo, a spanish-based free software startup. Lately we’ve been working with QML and now that I know it, it’s really nice. Some weeks ago I was with danigm (also from Wadobo) and we were talking about how nice it is to do mobile applications in QML, and how web applications are taking over desktop applications more and more. Do you know GTK already has an HTML/JS frontend? Demo here. BTW, Gnome guys have been working on something similar to QML too, ClutterScript.

And then the idea came out of the blue. QML could be (in my dreams 😉 the successor of HTML. I know, sounds crazy doesn’t it? That’s because it is crazy. So anyway, I wanted to test the concept, and today I coded this litle KPart called QmlPart that simply loads a .qml file into the KPart. The code is really minimal and it works beautifully, both in Konqueror and in rekonq, and loads fine both local and remote QML files and remote files, even if the QML application is divided in multiple files.

I am really surprised how easy it was to do this KPart. I uploaded to wadobo’s web server the Qt Declarative examples and most of them work out of the box with QmlPart. Here is a screencast:

Why would we want to make the web declarative? Because QML is much more powerful than HTML/CSS. Those of you that know QML will probably agree. HTML doesn’t even have a proper way to create column or row layouts. All kind of animations, transitions, states are easy-peasy in QML. And its object orientation is quite powerful, as they have properties, inheritance, etc. The web of 2011 can be much easily done in QML than in current web technologies.

What would be the path of action? This is just a proof of concept, and it might end here. Or it might not. If we get serious, we would first try to agree in a standard for a declarative web (talk to Gnome/ClutterScript guys), work in including this standard in web browsers, create a library in Javascript that allows loading declarative files as HTML/JS as a fallback for browsers without native declarative web support, and that way we can attract people to the platform, and then we would have something.

Either way, I had my fun today with this little kpart and all those crazy ideas around it. Mission accomplished.

13 Responses to “QMLPart: enabling a declarative web”

  1. 1 danigm diciembre 8, 2011 de 11:03 pm

    Great work, qml in my browser 😀

  2. 2 maour diciembre 9, 2011 de 2:19 am

    Waoooo, Greattttttttt!
    Actually i asked this quesion about a month ago on Qt channel that if we could have something like this in Qt!


  3. 3 terietor diciembre 9, 2011 de 9:35 am

    good work gyus!!

    QML in the web?That’s awesome!

  4. 4 Paul Gideon Dann diciembre 9, 2011 de 12:14 pm

    This is really cool, but if you’re seriously thinking of QML replacing HTML/JS, there are some other considerations, such as accessibility. QML is a UI language, and isn’t really suited to content. It would make great-looking web apps, but would not be great for representing articles, for instance.

    • 5 ary diciembre 9, 2011 de 5:32 pm

      Also, afaik, Qt supports no sandboxing of QML “applications” whatsoever, nor are the Qt developers interested into adding such features.

      This means that you should *never* execute QML files from untrusted sources.

  5. 6 Allaun Silverfox diciembre 9, 2011 de 3:14 pm

    Ironically enough, my browser doesn’t support h264 video. I’m using the Html5 version of youtube. >.<

  6. 7 Niko Sams diciembre 9, 2011 de 4:53 pm

    Cool stuff. But replacement for Html? Not really.

  7. 8 ri.p. diciembre 9, 2011 de 5:51 pm

    Great work!
    How could I try QMLPart on my computer? Can you publish a guide?

    PS: You should publish your work on Qt developers’ forum.

  8. 9 No'am Rosenthal (@noam_rosenthal) diciembre 9, 2011 de 7:18 pm

    Two key things that I think would make or break this project:

    1. security – it’s more than sandboxing QML files from the system; It’s about sandboxing QML files from different domains… For example you don’t want a QML file from an untrusted source to be able to bind a property to the browser’s address bar.

    2. versioning – So far QML has been pretty good with versioning, but still old QML files sometimes need a slight modification when the runtime changes. When you put a file on the web, you simply cannot break it with new versions of the runtime, even if it’s a subtle breakage.

    So, I agree with ary that until those two things (and others) are resolved, “QML on the web” is something that should be limited to trusted sources with a well-defined contentruntime relationship.

  9. 10 joe diciembre 9, 2011 de 11:44 pm

    Want to make this more Awesome make it an embeddable browser plug-in it would make a cool flash replacement and would allow websites to use it and merely link to where to get it like flash currently does.

  10. 12 skierpage diciembre 11, 2011 de 3:11 am

    Your link for “GTK already has an HTML/JS frontend? Demo here” is empty. As far as I know there’s no online demo of it, but Alexander Larsson has posted videos, e.g. http://blogs.gnome.org/alexl/2011/04/18/broadway-update-3/

    Broadway is a back-end, not a front-end. As I understand it, instead of rendering to an X11 display, or a framebuffer, GTK can now render to an HTML canvas. The GTK program running on some computer has the same OS dependencies and GTK libraries, it’s just accessible over the net in a browser. Of course with projects like Emscripten and jslinux compiling big projects into JavaScript, maybe the whole stack turns into JavaScript 🙂

    Your idea is very cool. Without sandboxing it’s more a way to present local programs and widgets (file:///home/me/coolapp.qml) in the browser. That won’t take off until some desktop environment wakes up and admits people use the browser more than their desktop’s increasingly irrelevant toolkit & panels & runners & start menus, and rebuilds itself around that fact.

  11. 13 netsurfer912 diciembre 20, 2014 de 2:00 am


    honestly i’ve been thinking about this exactly the way you are. I really fucking want to write QML for the web. The original QML scene graph could be ported to JS, couldn’t it?


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s

A %d blogueros les gusta esto: