QtQuick, the Plasma way

Software

Those days, working hard on bugfixing and polishing for the 4.5 SC release, however caught by the impatience of testing the new shiny features that will be in Qt 4.7, I gave a try on a weird crossover you’ll hear more and more about in the future: QtQuick+Plasma

Now, in playground there are some Plasma bindings for QML almost since the declarative module was announced, but only lately, as it matures for Qt 4.7 inclusion has been possible to expand them to make possible to have a quite good integration between the two technologies.

Work started in February at Tokamak 4, were thanks to the beginning of this integration was possible tohave a working prototype of Plasma Mobile in a single week, starting from zero.

As a test bed for expanding the bindings where something more was still needed, I did a prototype of a plasmoid with the interface a bit more complex than usual, that could be easily used as a full screen application in a mobile environment. Since there is another set of KDE applications for wich a mobile version is being written (all the KDE pim apps) i decided to just shamelessy copy from it, since is one where the visual design has been already done.

The video below shows a simple prototype of a mail client for a mobile device: the basic interaction works, even tough the data is dummy, being a simple demo.

OGG version

It’s written completely in QML, without a single C++ line of code, and can work both as a fullscreen mobile application as shown there as well as a normal Plasma widget in your desktop

A really important charateristic of this (and of the other future Plasma widgets written it this tecnique) is that exept the item view, it only uses Plasma widgets (widgets as in components like buttons, text fields etc) and animations, this will give some interesting benefits:

  • Consistent look and feel, either across your desktop or in various apps of your mobile device. Even across different kind of devices, like mobile, netbook and desktop, while having a radically different look to fit the different form factors, the applications will bring a certain level of familiarity and “unity”
  • The widgets have an consistent and rich api, that can be accessed from both Javascript and C++ pieces of code (or whatever language bindings), when a “QML only” approach is not enough.
  • The Plasma animations are written in Javascript themselves: they can be “themed” to achieve different feelings on different devices without having to touch code in the applications/plasmoids themselves. In the future will also be possible to do important things like turning them off globally when the battery level is critical or things like that.
  • great separation of data and visualization achieved trough dataenines: is possible to completely change the ui without ever touching the logic of the program or how the data is fetched, and write the visualization completely in a declarative way, while not being limited in any way in how the dataengine plugin is written.

As said before, to recap it will be possile to write plasmoids completely in QML, or include pieces of QML ui in any kind of plasmoid is already possible to write, being C++, Python, Ruby or even our already existing Javascript bindings.

This demo in the video isn’t going to be a real world application, but it is a really good showcase of what Plasma can offer in this regard, and how is easy to write a pretty rich mobile application that can be adapted across a wide range of devices. So in the future there will be many plasmoids that will rougly follow those lines.

Bits and pieces are still missing, some work remains to do, but for KDE SC 4.6 there will be in libplasma something that will be usable by everybody to build some awesome stuff.

1 thought on “QtQuick, the Plasma way

Comments are closed.