QML model with image and text per element

Viranch Mehta viranch.mehta at gmail.com
Sun Jun 26 22:17:25 CEST 2011


On Mon, Jun 27, 2011 at 12:16 AM, Shaun Reich <predator106 at gmail.com> wrote:

>
> Okay, so if the data is laid out as you said, in the last example..how
> would I display that in the qml view? Since I need to display *both*
> the icon and the user's name in the model. Give me something concrete,
> please -- as you well know, the docs suck ;-)
>
> With the method you prefer, you can have something like:

model: mainEngineSource.keysForSource("userList")

Component {
    id: delegateItem
    Item {
        Image { source:
mainEngineSource.data["userList"][modelData]["image"] }
        Text { text: mainEngineSource.data["userList"][modelData]["name"] }
    }

and assign delegate: delegateItem in the view.

Hope this helps.

Viranch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20110627/c6774b97/attachment.htm 


More information about the Plasma-devel mailing list