forked from heafox/learnqml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MovieListView.qml
58 lines (48 loc) · 1.09 KB
/
MovieListView.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
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
import Model 1.0
ApplicationWindow {
id: window
visible: true
width: 640
height: 480
title: qsTr("Tabs")
Component.onCompleted: {
var list = movieModel.get();
for (var i = 0; i < list.length; i++) {
movies.append(list[i]);
}
}
MovieModel {
id: movieModel
}
ListModel {
id: movies
}
ColumnLayout {
anchors.fill: parent
Label {
Layout.preferredHeight: 40
text: qsTr("Movies")
}
ListView {
Layout.fillWidth: true
Layout.fillHeight: true
model: movies
delegate: ItemDelegate {
contentItem: RowLayout {
Label {
text: title
}
Label {
text: director
}
Label {
text: rating
}
}
}
}
}
}