Accessing models from QML plasmoid

Marco Martin notmart at gmail.com
Sun Jun 19 19:34:42 CEST 2011


On Sunday 19 June 2011, Shantanu Tushar Jha wrote:
> Hi,
> 
> I am having the same doubt, I guess Marco can answer :)
> 
> Shantanu Tushar    (UTC +0530)
> http://www.shantanutushar.com
> 
> On Sat, Jun 18, 2011 at 12:37 AM, Francesco Nwokeka <
> 
> francesco.nwokeka at gmail.com> wrote:
> > Hi all,
> > 
> >        I'm working on a GSoC project and creating plasmoids for
> > 
> > kde-telepathy. I would like to know
> > from you guys, which would be the right approach to read info from a
> > model we have that retrieves
> > it's info from nepomuk.
> > 
> > Do I have to wrap this model as a dataengine, or is there a better way to
> > use a pre-existing
> > QAbstractItemModel in Plasma-QML?

to work in qml a qabstractitemmodel needs:

* one single column
* roles with actual names (assigned with setRoleNames)

to be "seen" is either setContextProperty from C++ (but in this case you can't 
do a qml-only plasmoid, it would have to be mixed qml c++)

or be exported in a plugin (that is then used with the import keyword)
in this case the model would be created and instantiated from within qml


in general, i prefer models in qml itemviews to be actual models, in 
libplasma2 i would instead like to have model support directly into the 
dataengine, that would be way cleaner, but unfortunately, not yet..

Cheers, 
Marco Martin


More information about the Plasma-devel mailing list