Thank You Andrey.

That too did work some wonders. At this point these little things really
are wonders to me :)

Basically now I have a nicely structured listing that is fetching the
wanted data from an Internet source.

By using spacing I could make the listing more readable if needed. So
learned something new on the side there.


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)


Greetings

Jani

On Wed, May 13, 2015 at 11:46 PM, Andrey Kozhevnikov <coderusin...@gmail.com
> wrote:

>  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:
>
>         delegate: BackgroundItem{
>             id:delegate
>             width: ListView.view.width
>             height: content.height
>
>             Column {
>                 id: content
>                 width: parent.width
>
>                 Text{
>                     width: parent.width
>                     font.pixelSize: Theme.fontSizeLarge
>                     color: Theme.primaryColor
>                     text: name
>                     wrapMode: Text.Wrap
>                 }
>
>                 Text{
>                     width: parent.width
>                     font.pixelSize: 15
>                     color: Theme.primaryColor
>                     text: price
>                     wrapMode: Text.Wrap
>                 }
>             }
>         }
>
> 14.05.2015 01:34, Jani Nuutinen пишет:
>
> Thank you for the generous insights gents.
>
>  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).
> The first code I used did work so I merely did expand on top of that with
> another "code training".
>
>  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.
> What is the correct way through the means of coding to change the relative
> position of those two (or even multiple) elements?
>
>  Code in pastebin this time:
>
>  http://pastebin.com/3ftxPyvk
>
>
>  XML:
>
>  http://www.w3schools.com/xml/simple.xml
>
>
>  Greetings
>
>  Jani
>
> On Wed, May 13, 2015 at 9:15 PM, Michael Fuchs <mic...@gmx.at> wrote:
>
>> Hi Jani,
>>
>> As somebody else wrote: JSON is the native data format for QML.
>>
>> I'm using XMLHttpRequest and JSON.parse() for my project.
>> Maybe this is something for you.
>>
>> greets,
>> Michael.
>>
>> On Tuesday 12 May 2015 22:58:16 Jani Nuutinen wrote:
>> > I'm trying early on to familiarize myself with passing data to the phone
>> > from the Internet and just for starters I chose to use a simple
>> XML-file to
>> > see if I could make something out myself. I do not know if using XML
>> from
>> > Internet source is the simplest or the smartest method, but trying to
>> > follow the scarce tutorials about passing XML data didn't seem to be
>> that
>> > challenging.
>> >
>> > Code:
>> >
>> > import QtQuick 2.0
>> >
>> > import Sailfish.Silica 1.0
>> >
>> > import QtQuick.XmlListModel 2.0
>> >
>> >
>> > Page{
>> >
>> >     id: root
>> >
>> >
>> >     XmlListModel{
>> >
>> >         id:noteXml
>> >
>> >         source:"http://www.w3schools.com/xml/note.xml";
>> >
>> >         query:"/note"
>> >
>> >         XmlRole{name: "body"; query: "body/string()"}
>> >
>> >     }
>> >
>> >
>> >     SilicaListView{
>> >
>> >          id:noteView
>> >
>> >          width: parent.width
>> >
>> >          height: parent.height
>> >
>> >          anchors.centerIn: parent
>> >
>> >
>> >          header: PageHeader{
>> >
>> >              title: "Note"
>> >
>> >          }
>> >
>> >
>> >          model:noteXml
>> >
>> >          }
>> >
>> >     }
>> >
>> >
>> >
>> > I've tried few other approaches but to me this seems the simplest
>> > method "coding wise". The app starts (in the emulator) as it should
>>  > and without errors, showing the first page with *Note* as the title.
>> > But no matter how much I'd like the XML getting passed on to the phone
>> > screen from the provided URL it never does.
>> >
>> >
>> > So I'm wondering what am I missing that should be included to get such
>> > a simple thing working?
>> >
>> >
>> >
>> > Greetings
>> >
>> >
>> > Asmodeus
>>  _______________________________________________
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> <devel-unsubscr...@lists.sailfishos.org>
>> devel-unsubscr...@lists.sailfishos.org
>>
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to