SelectableDecorator.qml Example File
listdecorators/assets/SelectableDecorator.qml
import bb.cascades 1.0
import bb.cascades.datamanager 1.2
import bb.cascades.decorators 1.2
ActionItem {
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
selectableModel.load()
listView.dataModel = selectableDecorator
listView.selectionChanged.connect(selectableDecorator.changeSelection)
}
attachedObjects: [
SelectionDataModelDecorator {
id: selectableDecorator
model: AsyncDataModel {
id: selectableModel
query: SqlDataQuery {
source: _sqlImagesDir + "/../discogs_small.db"
query: "select id, title, primary_image from master"
countQuery: "select count(*) from master"
onDataChanged: console.log("data changed: revision=" + revision)
onError: console.log("SQL query error: " + code + ", " + message)
}
onLoaded: console.log("initial model data is loaded")
}
}
]
}