main.qml Example File
callapizza/assets/main.qml
import bb.cascades 1.0
import bb.system.phone 1.0
import bb.data 1.0
Page {
AnimationContainer {
id: root
target1: logoImage
target2: upperHintImage
target3: lowerHintImage
target4: searchArea
target5: resultView
function startSearch()
{
root.playShowListViewAnimation()
_pizzeriaSearcher.zipCode = zipCodeField.text
}
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
ImageView {
id: logoImage
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Top
translationY: 50
imageSource: "asset:///images/logo.png"
}
Container {
id: searchArea
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Bottom
ImageView {
id: upperHintImage
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Top
imageSource: "asset:///images/upper_hint.png"
visible: !zipCodeField.focused
}
Container {
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
imageSource: "asset:///images/searcharea.png"
}
TextField {
id: zipCodeField
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
preferredWidth: 530
preferredHeight: 65
hintText: ""
input {
submitKey: SubmitKey.Search
onSubmitted: root.startSearch()
}
}
ImageButton {
horizontalAlignment: HorizontalAlignment.Right
verticalAlignment: VerticalAlignment.Center
translationX: -60
defaultImageSource: "asset:///images/find_button.png"
pressedImageSource: "asset:///images/find_button.png"
onClicked: root.startSearch()
}
}
ImageView {
id: lowerHintImage
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Bottom
imageSource: "asset:///images/lower_hint.png"
visible: !zipCodeField.focused
}
}
Container {
id: resultView
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
translationY: 1280
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Bottom
imageSource: "asset:///images/listview_background.png"
}
ResultListView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Bottom
dataModel: _pizzeriaSearcher.model
listItemComponents: [
ListItemComponent {
type: "item"
PizzeriaItem {
title: ListItemData.Title
description: ListItemData.Phone
}
}
]
onTriggered: {
phone.requestDialpad(dataModel.data(indexPath).Phone)
}
}
onTouch: {
if (event.isDown() && event.localY < root.hideTouchArea)
root.playHideListViewAnimation()
}
}
}
attachedObjects: [
Phone {
id: phone
}
]
}