QML model with image and text per element

Marco Martin notmart at gmail.com
Sun Jun 26 20:17:11 CEST 2011


On Sunday 26 June 2011, you wrote:
> On Sun, Jun 26, 2011 at 1:26 PM, Marco Martin <notmart at gmail.com> wrote:
> > all depends on... exactly what do you have as available data in the
> > model/dataengine? and what you could put?
> 
> I have the sources I mentioned, a qstringlist of the full names of the
> users..a list of the user's "short-name" (unix login), as well as a
> list for the user icons/images themselves. The part that I need help
> on, is associating all of them together (since they're really
> linked...I mean..you can't just associate a random user's image with a
> random name, naturally). Except I have to associate them in a way
> that's nicely accessible from a qml model..
> 
> > better way to me is having a field called image, icon, thubnail or
> > whatever makes sense directly in the dataengine, what problems do you
> > have to do so?
> 
> Hm? I'm not sure what you're asking. The data is of course, in the
> dataengine. I'm basically asking how to nicely group the
> aforementioned data together for easy displaying in qml.

well, i don't know how that data engine is done, but usually when representing 
a list of items they are done this way:
sone source per item, like 
source called as the login, then one key per "role" for instance a key with 
login one with name, one with user image...
from the dataengine you do for instabce setData("john", "name", "John Doe")

alternatively, the source could be a functionality, like "userList", then 
userList will have a key for each user and then the same structure: every item 
a varianthash with all the user data...

if that dataengine is done in a completely different way that makes impossible 
to map the list in this way...
really it's wrong(tm) ;p


Cheers,
Marco Martin


More information about the Plasma-devel mailing list