Declarative UI Integration, reprise

Alan Alpert alan.alpert at
Thu Sep 24 08:31:34 CEST 2009

Hello Plasma Devs,

Firstly, I've just written a blog post about the Declarative UI plasma 
integration (
and-plasma/ ). It explains the vision of Declarative UI, as it relates to 
Plasma, and what we hope to achieve with it. So if you don't know why the 
integration exists you might want to read that first.

Thanks for the feedback you gave on the initial Declarative UI plasma 
integration. Between addressing that and a lot of internal feedback an awful 
lot has changed in Declarative UI since then. I've tried to update the plasma 
integration to the modern day, and also cleaned it up a little. I think that 
all the concerns from your previous feedback have been addressed (please 
correct me if I'm wrong) so I'd like any more constructive criticism you have. 
I'll just enumerate some of the key changes since last time:

-Declarative UI is using Graphics View, which simplifies the integration
-Has a simple implementation of exposing the Plasma Widgets in QML (look at 
the examples that have 'Plasma.PushButton { ... }', like picture.qml)
-Names of most elements have changed, and you need import statements to get 
any items at all.

After one round of changing everything, we're in a more stable period so now's 
a good time to play with the technology. I'm hoping that by now it is close 
enough that you can use it to write plasmoids fine - with the caveat that you 
still need the declarative UI version of Qt (we still haven't merged into 
mainline Qt). It has the viewer plasmoid and QML script engine like before, 
but also has a KineticApplet class that you can subclass, to write a C++ 
applet with a Declarative UI front end (and thus still have a conventional 
settings dialog). The examples are still about the same, you'll have noticed 
by now that I have little in the way of design talent to spruce them up. A 
picture.qml example has been added, all it does is show using plasma widgets 
and animation in a slightly less useless way than the widgets.qml.

I've noticed the discussion about JS bindings for plasma, my interpretation is 
that these allow you to write imperative JS code to setup a QGraphicsWidget in 
the standard imperative way, including writing an imperative painting 
function. If so then there's no problematic overlap, it's just another binding 
language but please correct me if I'm wrong. Mixing imperative with 
declarative gets confusing easily and needs to be handled carefully so I'd 
rather avoid mixing JS bindings and QML at this point. I suspect it would be 
easy to do, but hard to do well.

I welcome feedback, or any suggestions on how this can be made more useful for 
Plasma. In particular I'd welcome feedback on how we're integrating with 
existing code. I'm hopeful that we can integrate existing items without having 
to re-write anything at all (like the integration currently does), without 
compromising the usefulness of the integration.

Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks

More information about the Plasma-devel mailing list