Skip to content

Instantly share code, notes, and snippets.

@shaan7
Created July 29, 2014 17:27
Show Gist options
  • Save shaan7/eb53f781e47d965a014d to your computer and use it in GitHub Desktop.
Save shaan7/eb53f781e47d965a014d to your computer and use it in GitHub Desktop.
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.XmlListModel 2.0
GridView {
id: theGrid
signal clicked(string url)
anchors { fill: parent; margins: 10 }
header: Label { text: theGrid.count + " items" }
delegate: Image {
property string url_without_size: "http://farm" + farm + ".static.flickr.com/" + server + "/" + id + "_" + secret
source: url_without_size + "_s.jpg"
MouseArea {
anchors.fill: parent
onClicked: theGrid.clicked(parent.url_without_size)
}
}
model: XmlListModel {
property variant coordinate
source: "http://api.flickr.com/services/rest/?" +
"min_taken_date=2000-01-01+0:00:00&" +
"extras=date_taken&" +
"method=flickr.photos.search&" +
"per_page=30&" +
"sort=date-taken-desc&" +
"api_key=e36784df8a03fea04c22ed93318b291c&" +
"lat=" + coordinate.latitude + "&lon=" + coordinate.longitude;
query: "/rsp/photos/photo"
XmlRole { name: "title"; query: "@title/string()" }
XmlRole { name: "datetaken"; query: "@datetaken/string()" }
XmlRole { name: "farm"; query: "@farm/string()" }
XmlRole { name: "server"; query: "@server/string()" }
XmlRole { name: "id"; query: "@id/string()" }
XmlRole { name: "secret"; query: "@secret/string()" }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment