12-05-2012 09:29 AM - edited 12-05-2012 09:31 AM
Dear All,
I am building an barcode reader webworks extension for Blackberry10 using Steps at https://developer.blackberry.com/html5/documentati
The cascade SDK has a provision to scan barcode using BarcodeDetector and Camera
For Creating the native part of the extension
My .qml file is
The Camera code in .qml
Camera {
id: camera
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
onCameraOpened: {
// Apply some settings after the camera was opened successfully
getSettings(cameraSettings)
cameraSettings.focusMode = CameraFocusMode.ContinuousAuto
cameraSettings.shootingMode = CameraShootingMode.Stabilization
applySettings(cameraSettings)
// Start the view finder as it is needed by the barcode detector
camera.startViewfinder()
}
onViewfinderStarted: {
// Setup the barcode detector with the camera object now
barcodeDetector.camera = camera
barcodeDetector.formats = BarcodeFormat.Any
}
attachedObjects: [
CameraSettings {
id: cameraSettings
}
]
}
The BarcodeDetector code in qml
attachedObjects: [
BarcodeDetector {
id: barcodeDetector
/*cameraChanged: {
setFormats(0xffff);
}*/
onBarcodeDetected: {
if (resultLabel.text != data) {
resultLabel.text = data;
resultArea.visible = true;
}
}
}
The Second part Creating the JavaScript part of the extension is done
I am able to invoke the scan function.
When I am tring
QmlDocument *qml = QmlDocument::create("asset:///mainn.qml");
// Create the application scene
AbstractPane *appPage = qml->createRootObject<AbstractPane>();
Application::instance()->setScene(appPage);
return Application::exec();
THE APPLICATION GETS FREEZ. NOTING COMES.......![]()
Thank in advance. Waiting for reply.....
12-05-2012 10:26 AM
Maybe a stupid question, but should this say:
QmlDocument *qml = QmlDocument::create("asset:///mainn.qml");
or is it supposed to say:
QmlDocument *qml = QmlDocument::create("asset:///main.qml");
12-05-2012 10:52 AM
By only posting bits of your code it's hard to know what might be wrong.
Camera is presumably only going to work on a dev alpha device, not the simulator... you didn't say but just in case.
You've only posted the bit that uses "Camera" which is a custom control, not an AbstractPane derived component - is the Camera control in something like a Page?
If you can check the debugging info here and setup slog2info via ssh then the app should tell you what's wrong.
https://developer.blackberry.com/cascades/document
12-06-2012 01:52 AM - edited 12-06-2012 02:23 AM
_harolde Thanks for reply....
Its not a stupid question.
I am trying to load mainn.qml as well as main.qml in both cases the application gets freez
my mainn.qml contains simple hello world as below
// Default empty project template
import bb.cascades 1.0
// creates one page with a label
Page {
Container {
layout: DockLayout {}
Label {
text: qsTr("Hello World")
textStyle.base: SystemDefaults.TextStyles.BigText
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center
}
}
}
and main.qml contains the code posted in previous post.
I thought like problem is while loading qml containing camera thats why i tried to load simple hello world and same result "APPLICATION FREEZE"....
I am trying to build a webworks extension. c++ shared library....
Please keep posting........
Thanks in advance
12-06-2012 01:57 AM
12-06-2012 04:27 AM - edited 12-06-2012 04:39 AM
>> I am trying to build shared library not an application.
The way you're using QML you still need the root element to be derived from AbstractPane - e.g. the Page in your hello world example.
When things just freeze there is very rarely an exception but there should be something in the console log - were you able to view the log?
I can't really help with debugging the interaction between WebWorks and C++/QML because I've not got the webworks tools installed and don't use them.
Isn't there an example of a native extension using QML anywhere? I think the part where you try to get the QML displayed is almost certainly wrong...
return Application::exec();
This line starts the application run loop, which will almost certainly already be running. When you do this I believe you get a nested run loop, which would probably make the application freeze, since input events etc would be queued for the other run loop.
12-06-2012 08:00 AM - edited 12-06-2012 08:02 AM
The simplified defination of my issue is:
I want to use cascade camera by creating shared library using BBNDK via webworks application for scanning barcode on BB Dev Alpha device........
Any help is appreciated.....
Waiting for the reply.....
Thanks in advance.......