main.qml Example File
custombarcodescanner/assets/main.qml
import bb.cascades 1.0
import bb.community.barcode 1.0
NavigationPane {
onCreationCompleted: {
_barcodeScanner.startScan.connect(barcodeDecoder.startScanning)
_barcodeScanner.stopScan.connect(barcodeDecoder.stopScanning)
}
Page {
titleBar: TitleBar {
title: qsTr("Barcode Scanner")
appearance: TitleBarAppearance.Branded
}
Container {
layout: DockLayout {
}
background: Color.Black
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Top
BarcodeDecoder {
id: barcodeDecoder
onNewBarcodeDetected: {
barcodeLabel.text = barcode
_barcodeScanner.newBarcodeDetected(barcode)
}
}
}
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Bottom
bottomPadding: 20
Label {
id: barcodeLabel
text: qsTr("Scan a barcode")
textStyle.color: Color.White
}
}
}
}
}