[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: QML model with image and text per element
From: Viranch Mehta <viranch.mehta () gmail ! com>
Date: 2011-06-26 20:29:25
Message-ID: BANLkTinYxdR2Au_nMEQMXt905iHdoJ023w () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Mon, Jun 27, 2011 at 12:16 AM, Shaun Reich <predator106@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
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_quote">On Mon, Jun 27, 2011 at 12:16 AM, Shaun Reich \
<span dir="ltr"><<a \
href="mailto:predator106@gmail.com">predator106@gmail.com</a>></span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex;"> <div class="im"><br></div>
Okay, so if the data is laid out as you said, in the last example..how<br>
would I display that in the qml view? Since I need to display *both*<br>
the icon and the user's name in the model. Give me something concrete,<br>
please -- as you well know, the docs suck ;-)<br>
<div class="im"><br></div></blockquote><div>With the method you prefer, you can have \
something like:</div><div><br></div><div>model: \
mainEngineSource.keysForSource("userList")</div><div><br></div><div>Component \
{</div> <div> id: delegateItem</div><div><meta http-equiv="content-type" \
content="text/html; charset=utf-8"> Item {</div><div><meta \
http-equiv="content-type" content="text/html; charset=utf-8"> Image { source: \
mainEngineSource.data["userList"][modelData]["image"] }</div> \
<div><meta http-equiv="content-type" content="text/html; charset=utf-8"> Text \
{ text: <meta http-equiv="content-type" content="text/html; \
charset=utf-8">mainEngineSource.data["userList"][modelData]["name"] \
}</div> <meta http-equiv="content-type" content="text/html; charset=utf-8"><meta \
http-equiv="content-type" content="text/html; charset=utf-8"><meta \
http-equiv="content-type" content="text/html; charset=utf-8"><div><meta \
http-equiv="content-type" content="text/html; charset=utf-8"> }</div> \
<div><br></div><div>and assign delegate: delegateItem in the \
view.</div><div><br></div><div>Hope this \
helps.</div><div><br></div><div>Viranch</div><div><br></div></div></div>
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic