Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Simple Flickr viewer - no pictures displayed
QtWS25 Last Chance

[Solved] Simple Flickr viewer - no pictures displayed

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    strekazoid
    wrote on last edited by
    #1

    Trying to do a simple Flickr stream viewer. The problem is that though XmlLIstModel loads data, no pictures are displayed in the GridView. Wonder what could be wrong here?

    @import Qt 4.7

    Rectangle {
    width: 640
    height: 480

    GridView {
        id: grid_view
        x: 91
        y: 41
        width: 484
        height: 378
        cellHeight: height/4
        cellWidth: width/4
        model: myFlickrStream
        delegate: Column {
            Image {
                source: imagePath
                anchors.horizontalCenter: parent.horizontalCenter
            }
            Text {
                text:  title
                anchors.horizontalCenter: parent.horizontalCenter
            }
    
        }
    }
    
    XmlListModel {
        id: myFlickrStream
        source: "http://api.flickr.com/services/feeds/photoset.gne?set=72157625224936781&nsid=23802687@N06&lang=en-us"
        query: "/feed/entry"
        namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
    
        XmlRole { name: "title"; query: "title/string()" }
        XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" }
    
        onStatusChanged: {
            if(myFlickrStream.status==XmlListModel.Error) {
                textStatus.text=myFlickrStream.errorString();
            }
            else if(myFlickrStream.status==XmlListModel.Loading) {
                textStatus.text="loading";
            }
            else if(myFlickrStream.status==XmlListModel.Ready) {
                textStatus.text="ready";
            }
    
        }
    }
    Text {
        id: textStatus
        x: 56
        y: 448
        width: 80
        height: 20
        text: ""
        font.bold: true
        font.pointSize: 10
    }
    

    }@

    1 Reply Last reply
    0
    • S Offline
      S Offline
      strekazoid
      wrote on last edited by
      #2

      Nevermind, got it :D The problem was in nameSpaceDeclaration - it should be like this:

      @namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"@

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved