-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
97 lines (89 loc) · 2.46 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.XmlListModel 2.0
ApplicationWindow {
title: qsTr("Qt Quick Controls Test")
width: 640
height: 480
visible: true
menuBar: MenuBar {
Menu {
title: qsTr("&File")
MenuItem {
text: qsTr("E&xit")
onTriggered: Qt.quit();
}
}
}
toolBar: ToolBar {
width: parent.width
height: toolbarLayout.height + 10
RowLayout {
id: toolbarLayout
width: parent.width
anchors.verticalCenter: parent.verticalCenter
Text {
text: qsTr("Zoom")
}
Slider {
id: zoom
value: 0.5
Layout.fillWidth: true
implicitWidth: 100
}
Text {
text: "Search"
}
TextField {
id: search
text: ""
Layout.fillWidth: true
implicitWidth: 100
}
}
}
SplitView {
anchors.fill: parent
TableView {
id: table
height: parent.height
TableViewColumn { role: "title" }
model: flickrModel
}
ScrollView {
width: parent.width - table.width
height: parent.height
Image {
id: image
source: flickrModel.get(table.currentRow).source.replace("_s", "_b")
fillMode: Image.PreserveAspectFit
scale: zoom.value + 0.5
anchors.centerIn: parent
}
}
}
statusBar: StatusBar {
RowLayout {
width: parent.width
Text {
text: image.source
Layout.fillWidth: true
elide: Text.ElideMiddle
}
ProgressBar {
value: image.progress
}
}
}
XmlListModel {
id: flickrModel
source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2&tags=" + search.text
query: "/rss/channel/item"
namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "source"; query: "media:thumbnail/@url/string()" }
}
}