[Solved] Simple Flickr viewer - no pictures displayed



  • 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
    }
    

    }@



  • 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';"@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.