<div dir="ltr">Thank You Andrey.<div><br></div><div><br></div><div>That too did work some wonders. At this point these little things really are wonders to me :)</div><div><br></div><div>Basically now I have a nicely structured listing that is fetching the wanted data from an Internet source.</div><div><br></div><div>By using spacing I could make the listing more readable if needed. So learned something new on the side there.</div><div><br></div><div><br></div><div>Though I have one particular goal that I'd like to reach one day by learning to create apps for Sailfish with Qt, I guess for now I'm off to learn something new and see what I can come up with (hopefully "something" at least :D)</div><div><br></div><div><br></div><div>Greetings</div><div><br></div><div>Jani</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 13, 2015 at 11:46 PM, Andrey Kozhevnikov <span dir="ltr"><<a href="mailto:coderusinbox@gmail.com" target="_blank">coderusinbox@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 text="#000000" bgcolor="#FFFFFF">
You should set elements position yourself. Elements itself have no
idea where each should be placed and drawing at (0,0) position by
default. Good idea will be to use Column as main element and place
your text inside it. So, it should be something like:<br>
<br>
<tt> delegate: BackgroundItem{</tt><tt><br>
</tt><tt> id:delegate<br>
width: ListView.view.width<br>
</tt><tt></tt><tt> </tt><tt>height: content.height<br>
<br>
Column {<br>
id: content<br>
width: parent.width<br>
</tt><tt> </tt><tt><br>
</tt><tt> Text{</tt><tt><br>
width: parent.width<br>
</tt><tt> font.pixelSize: Theme.fontSizeLarge</tt><tt><br>
</tt><tt> color: Theme.primaryColor</tt><tt><br>
</tt><tt> text: name<br>
wrapMode: Text.Wrap<br>
</tt><tt></tt><tt> }</tt><tt><br>
<br>
</tt><tt> Text{</tt><tt><br>
width: parent.width<br>
</tt><tt> font.pixelSize: 15</tt><tt><br>
</tt><tt> color: Theme.primaryColor</tt><tt><br>
</tt><tt> text: price</tt><tt><br>
wrapMode: Text.Wrap</tt><tt><br>
}</tt><tt><br>
}<br>
</tt><tt> }</tt><br>
<br>
<div>14.05.2015 01:34, Jani Nuutinen пишет:<br>
</div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">Thank you for the generous insights gents.
<div><br>
</div>
<div>While I'm still learning from ground up these simplest
things with Qt delegate was the thing here to get some flesh
on the bones (as in: getting something to show up on the
emulator screen).</div>
<div>The first code I used did work so I merely did expand on
top of that with another "code training".</div>
<div><br>
</div>
<div>This time the new code has two XmlRole elements: one for
the "name" of products and the other for the "price" of the
products. If I pass these two through the delegate component
the data seems to overlap on the emulator screen.</div>
<div>What is the correct way through the means of coding to
change the relative position of those two (or even multiple)
elements?</div>
<div><br>
</div>
<div>Code in pastebin this time:</div>
<div><br>
</div>
<div><a href="http://pastebin.com/3ftxPyvk" target="_blank">http://pastebin.com/3ftxPyvk</a><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>XML:</div>
<div><br>
</div>
<div><a href="http://www.w3schools.com/xml/simple.xml" target="_blank">http://www.w3schools.com/xml/simple.xml</a><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Greetings</div>
<div><br>
</div>
<div>Jani</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, May 13, 2015 at 9:15 PM,
Michael Fuchs <span dir="ltr"><<a href="mailto:michfu@gmx.at" target="_blank">michfu@gmx.at</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jani,<br>
<br>
As somebody else wrote: JSON is the native data format for
QML.<br>
<br>
I'm using XMLHttpRequest and JSON.parse() for my project.<br>
Maybe this is something for you.<br>
<br>
greets,<br>
Michael.<br>
<div>
<div><br>
On Tuesday 12 May 2015 22:58:16 Jani Nuutinen wrote:<br>
> I'm trying early on to familiarize myself with
passing data to the phone<br>
> from the Internet and just for starters I chose to
use a simple XML-file to<br>
> see if I could make something out myself. I do not
know if using XML from<br>
> Internet source is the simplest or the smartest
method, but trying to<br>
> follow the scarce tutorials about passing XML data
didn't seem to be that<br>
> challenging.<br>
><br>
> Code:<br>
><br>
> import QtQuick 2.0<br>
><br>
> import Sailfish.Silica 1.0<br>
><br>
> import QtQuick.XmlListModel 2.0<br>
><br>
><br>
> Page{<br>
><br>
> id: root<br>
><br>
><br>
> XmlListModel{<br>
><br>
> id:noteXml<br>
><br>
> source:"<a href="http://www.w3schools.com/xml/note.xml" target="_blank">http://www.w3schools.com/xml/note.xml</a>"<br>
><br>
> query:"/note"<br>
><br>
> XmlRole{name: "body"; query:
"body/string()"}<br>
><br>
> }<br>
><br>
><br>
> SilicaListView{<br>
><br>
> id:noteView<br>
><br>
> width: parent.width<br>
><br>
> height: parent.height<br>
><br>
> anchors.centerIn: parent<br>
><br>
><br>
> header: PageHeader{<br>
><br>
> title: "Note"<br>
><br>
> }<br>
><br>
><br>
> model:noteXml<br>
><br>
> }<br>
><br>
> }<br>
><br>
><br>
><br>
> I've tried few other approaches but to me this
seems the simplest<br>
> method "coding wise". The app starts (in the
emulator) as it should<br>
</div>
</div>
> and without errors, showing the first page with *Note*
as the title.<br>
<span>> But no matter how much I'd like
the XML getting passed on to the phone<br>
> screen from the provided URL it never does.<br>
><br>
><br>
> So I'm wondering what am I missing that should be
included to get such<br>
> a simple thing working?<br>
><br>
><br>
><br>
> Greetings<br>
><br>
><br>
> Asmodeus<br>
</span>
<div>
<div>_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank"></a><a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a><br></blockquote></div><br></div>