main.qml Example File
addressbook/assets/main.qml
import bb.cascades 1.0
NavigationPane {
id: navigationPane
onPopTransitionEnded: page.destroy()
Page {
Container {
layout: DockLayout {}
BackgroundImage {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
leftPadding: 30
topPadding: 30
rightPadding: 30
bottomPadding: 30
TextField {
hintText: qsTr ("Filter by...")
onTextChanging: _addressBook.filter = text
}
ListView {
dataModel: _addressBook.model
listItemComponents: ListItemComponent {
type: "item"
StandardListItem {
title: qsTr ("%1, %2").arg(ListItemData.lastName).arg(ListItemData.firstName)
description: ListItemData.email
}
}
onTriggered: {
clearSelection()
select(indexPath)
_addressBook.setCurrentContact(indexPath)
_addressBook.viewContact();
navigationPane.push(contactViewer.createObject())
}
}
}
}
actions: [
ActionItem {
title: qsTr ("New")
imageSource: "asset:///images/action_addcontact.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
_addressBook.createContact()
navigationPane.push(contactEditor.createObject())
}
}
]
}
attachedObjects: [
ComponentDefinition {
id: contactEditor
source: "ContactEditor.qml"
},
ComponentDefinition {
id: contactViewer
source: "ContactViewer.qml"
}
]
}