/
main.qml
162 lines (156 loc) · 5.89 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import bb.cascades 1.4
import bb.data 1.0
NavigationPane {
id: nav
Page {
titleBar: TitleBar {
title: "HVL"
selectedOption: Option {
}
scrollBehavior: TitleBarScrollBehavior.Sticky
kind: TitleBarKind.Default
visibility: ChromeVisibility.Visible
}
actions: [
ActionItem {
title: "SQ-1"
onTriggered: {
lisslp.spaceQuota=1
}
ActionBar.placement: ActionBarPlacement.OnBar
},
ActionItem {
title: "SQ-2"
onTriggered: {
lisslp.spaceQuota=2
}
ActionBar.placement: ActionBarPlacement.OnBar
}
]
Container {
horizontalAlignment: HorizontalAlignment.Fill
focusPolicy: FocusPolicy.Default
background: Color.DarkCyan
leftPadding: 8.0
bottomPadding: 8.0
topPadding: 8.0
rightPadding: 8.0
layoutProperties: StackLayoutProperties {
spaceQuota: 2
}
ListView {
id: lis
dataModel: theModel
onTriggered: {
var chosenItem = dataModel.data(indexPath);
var contentpage = itemPageDefinition.createObject();
nav.push(contentpage);
}
attachedObjects: [
ListScrollStateHandler {
onFirstVisibleItemChanged: {
console.debug("FVIC: "+firstVisibleItem[0])
}
}
]
accessibility.name: "Listing"
scrollRole: ScrollRole.None
snapMode: SnapMode.LeadingEdge
layout: StackListLayout {
orientation: LayoutOrientation.LeftToRight
headerMode: ListHeaderMode.None
}
flickMode: FlickMode.Momentum
listItemComponents: [
ListItemComponent {
type: "item"
Container {
id: imageView
minWidth: 720/3
maxWidth: 768/3
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Top
background: Color.DarkBlue
Label {
text: ListItemData.title
horizontalAlignment: HorizontalAlignment.Fill
textStyle.fontSize: FontSize.XLarge
textStyle.color: Color.LightGray
}
ImageView {
imageSource: ListItemData.image
loadEffect: ImageViewLoadEffect.None
verticalAlignment: VerticalAlignment.Fill
horizontalAlignment: HorizontalAlignment.Fill
scalingMethod: ScalingMethod.AspectFill
minWidth: 256
maxWidth: imageView.maxWidth
}
attachedObjects: [
LayoutUpdateHandler {
onLayoutFrameChanged: {
imageView.ListItem.view.updateListMaxHeight(layoutFrame.height);
}
}
]
}
}
]
function updateListMaxHeight(height) {
console.debug(height)
lis.maxHeight = height + 16;
}
horizontalAlignment: HorizontalAlignment.Fill
minHeight: 64
layoutProperties: StackLayoutProperties {
id: lisslp
spaceQuota: 1.0
}
scrollIndicatorMode: ScrollIndicatorMode.ProportionalBar
leadingVisual: Button {
text: "OK"
}
verticalAlignment: VerticalAlignment.Top
locallyFocused: false
}
Divider {
bottomMargin: 8.0
topMargin: 8.0
}
Container {
verticalAlignment: VerticalAlignment.Fill
layoutProperties: StackLayoutProperties {
spaceQuota: 4
}
Button {
color: Color.DarkBlue
text: "Button 1 2 3 4 5 6 7 8"
}
}
}
}
attachedObjects: [
ComponentDefinition {
id: itemPageDefinition
source: "ItemPage.qml"
},
GroupDataModel {
id: theModel
grouping: ItemGrouping.None
}
]
onPopTransitionEnded: {
page.destroy();
}
onCreationCompleted: {
theModel.insert({"title": "Amiga", "image": "amiga_kb.jpg" })
theModel.insert({"title": "Atari", "image": "atari.jpg" })
theModel.insert({"title": "C64", "image": "sidchip.jpg" })
theModel.insert({"title": "Amiga", "image": "amiga_kb.jpg" })
theModel.insert({"title": "Atari", "image": "atari.jpg" })
theModel.insert({"title": "C64", "image": "sidchip.jpg" })
theModel.insert({"title": "Amiga", "image": "amiga_kb.jpg" })
theModel.insert({"title": "Atari", "image": "atari.jpg" })
theModel.insert({"title": "C64", "image": "sidchip.jpg" })
}
}