kinetic-declarative plasma integration

Alan Alpert alanalpert at optusnet.com.au
Wed May 13 14:36:24 CEST 2009


On Wednesday 13 May 2009 22:05:40 Marco Martin wrote:
> On Wednesday 13 May 2009, Alan Alpert wrote:
> > Hi Plasma devs,
> >
> > Those of you following Qt Labs closely will have heard about Qt Kinetic's
> > Declarative UI
> > http://labs.trolltech.com/blogs/2009/05/13/qt-declarative-ui/ . As
> > Declarative UI is targeted towards enhancing the same sorts of
> > applications as Plasma, plasma integration is a good real-world fit. So
> > we've throw something together (it's in
> > playground/base/plasma/kinetic-declarative) and hope that it might be
> > useful in your plans to add Netbook and media center components;
> > declarative UI is designed to help create embedded device style UIs! The
> > Plasma integration we've done allows plasmoids to be written exclusively
> > in QML, or in conjunction with C++. I'll let the blog posting handle all
> > the riveting details on Declarative UI itself, and focus on providing
> > more technical details about the plasma integration we've done.
>
> taking a quick look rigt now, i still didn't understood whell the whole
> thing, but i have some (maybe naive) questions:
> when the items are declared, like in the dial example with
> Item {
>     property real value : 0
>
>     width: 210; height: 210
> etc etc..
>
> what happens behind the scenes? does a real widget get created? qwidget?
> qgraphicswidget?

the 'Item' item instantiates a QFxItem object, but any QObject subclass can in 
theory be made visible in QML. We haven't really looked into QWidgets though, 
we're focused more on the canvas based items. QGraphicsWidget should work, 
although it's not designed for declarative use like QFxItem is.

> so, as far i understood from your message is still not possible to use
> plasma widgets, but will it be possible in the future? (so defining for
> instance a Plasma::Pushbutton in qml syntax..)

Certainly. It's only not possible because I haven't implemented that part of 
the integration yet.

> what i think we would need is defining uis using our widgets in this way,
> keeping them reachable from eventual c++ (or other bindings) code
> and also the layouting information (how it does move/resize/update the
> widgetS?  it uses qgraphicslayouts?)
Layouts can be QGraphicsLayouts, but there are some QFx layouts that were 
designed for declarative use. More often though in declarative UI you use 
anchors to layout. This declaratively specifies layouts by saying what is next 
to what. Just placing things in a linear layout is more of an imperative 
approach.

Also the objects exposed, like Item, are controlled in QML through Q_PROPERTY 
and Q_INVOKABLE code in a C++ class. Both properties and invokable functions 
are reachable from C++ (and thus presumably other bindings). Even items defined 
entirely in QML have properties and signals that can be accessed like any 
other QObject from C++.
>
> those are the things i'm wondering after a quick look, after playing a
> little bit with it probably i will have more meaningful ones :)
>
> Cheers,
> Marco Martin

--
Alan Alpert


More information about the Plasma-devel mailing list