×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    10

    Problem with xmlListModel (NEED HELP! )

    I just don't understand why doesn't it take information(posts) from the web.... it doesn't show post in the appp I have checked listview is working...




    XmlListModel {
    id: feedModel
    namespaceDeclarations: "declare default element namespace 'http://www.w3.org/1999/xhtml';"
    source: "http://www.reddit.com/.rss"
    query: "/channel/.rss/item"

    XmlRole { name: "title"; query: "title/string()" }
    XmlRole { name: "link"; query: "link/string()" }
    XmlRole { name: "text"; query: "text/string()" }
    XmlRole { name: "pubDate"; query: "pubDate/string()" }
    }
    Last edited by Evaldas12; 2012-04-05 at 18:41.

  2. #2
    Regular Contributor
    Join Date
    Nov 2009
    Posts
    200

    Re: Problem with xmlListModel (NEED HELP! )

    try changing query to "/rss/channel/item"

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    10

    Re: Problem with xmlListModel (NEED HELP! )

    Thank you ;] just fixed problem were with query and name space , now I have new problem an easy problem , but I don't know how to do it, its I want to make links to open externally in a mobile browser when you click on them , now they are like text , how to do it ? ( I use command MouseArea {onClicked: Qt.openUrlExternally(linktxt)}) <--- but it doesn't do anything ( and sorry if this is stupid Im newbie/starter at qt )

    }
    Text {
    id: linktxt
    width: parent.width; text: link
    wrapMode: Text.WordWrap; font.family: "Helvetica"
    }
    Last edited by Evaldas12; 2012-04-05 at 21:20.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Problem with xmlListModel (NEED HELP! )

    Hello Evaldas12

    why don't use hyperlink on the text and than use the onLinkActivated signal to take user to the mobile native browser, small code snippet to use that:

    Code:
    Text {
                 textFormat: Text.RichText
                 text: " <a href=\"http://qt.nokia.com\">"+text+"</a>."
                 onLinkActivated: Qt.openUrlExternally(some url)
         }

  5. #5
    Registered User
    Join Date
    Mar 2012
    Posts
    10

    Re: Problem with xmlListModel (NEED HELP! )

    thanks but I want to open link/string which I get from the web

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Problem with xmlListModel (NEED HELP! )

    so whats the problem in that ?? Check the code below:

    Code:
    Text {
                 textFormat: Text.RichText
                 text: " <a href=\"+your link+\">"+your text+"</a>."
                 onLinkActivated: Qt.openUrlExternally(yourlink)
         }
    I have not tested this code but it should work.

  7. #7
    Registered User
    Join Date
    Mar 2012
    Posts
    10

    Re: Problem with xmlListModel (NEED HELP! )

    yes this code is good it changes the links from the text color to link but when you click on them they open only specified link "your link " and I want that they would open many different link because link/string gives me about 25 diff links
    ex.

    //post
    //link

    //post2
    //link2 <-------------- but all the links are opening "your link"

    //post3
    //link3

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Problem with xmlListModel (NEED HELP! )

    i suppose its a listview delegate you are talking about which contains a text element, so why don't you directly use link from the XMLModel, in text of your delegate.

    Then i think every link will open to the link you want.

  9. #9
    Registered User
    Join Date
    Mar 2012
    Posts
    10

    Re: Problem with xmlListModel (NEED HELP! )

    that's the problem I doesn't open externaly ;///

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Problem with xmlListModel (NEED HELP! )

    you need to show me your delegate code and model to get next answer :-)

  11. #11
    Registered User
    Join Date
    Mar 2012
    Posts
    10

    Re: Problem with xmlListModel (NEED HELP! )

    maybe via Skype ?

Similar Threads

  1. Nested XML parsing problem with XmlListModel
    By ram4soft in forum [Archived] Qt Quick
    Replies: 3
    Last Post: 2011-12-27, 14:04
  2. Searching in xmlListModel
    By Seikeau in forum [Archived] Qt Quick
    Replies: 1
    Last Post: 2011-11-14, 11:54
  3. XmlListModel problem
    By bgenady in forum [Archived] Qt Quick
    Replies: 2
    Last Post: 2011-08-01, 06:51
  4. XmlListModel and setRawHeader
    By atonical in forum [Archived] Qt Quick
    Replies: 1
    Last Post: 2011-07-14, 07:04
  5. Problem with XMLListModel
    By manikantan in forum [Archived] Qt Quick
    Replies: 3
    Last Post: 2011-06-27, 16:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×