Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
abhisardeshmukh
Posts: 12
Registered: ‎05-26-2010
My Device: Dev Alpha
My Carrier: Airtel

Is it possible to use .qml in For Creating the native part of the extension Blackberry 10

[ Edited ]

Dear All,

 

I am building an barcode reader webworks extension for Blackberry10 using Steps at https://developer.blackberry.com/html5/documentation/creating_extensions_for_bb10_apps.html

 

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.......:manfrustrated:

 

 

 

 

Thank in advance. Waiting for reply.....

New Contributor
_harolde
Posts: 5
Registered: ‎05-06-2012
My Device: Bold 9900

Re: Is it possible to use .qml in For Creating the native part of the extension Blackberry 10

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");

 

Developer
markwilcox
Posts: 51
Registered: ‎11-23-2012
My Device: BB10 Dev Alpha

Re: Is it possible to use .qml in For Creating the native part of the extension Blackberry 10

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/documentation/getting_started/tools/debug_and_profile.html

Contributor
abhisardeshmukh
Posts: 12
Registered: ‎05-26-2010
My Device: Dev Alpha
My Carrier: Airtel

Re: Is it possible to use .qml in For Creating the native part of the extension Blackberry 10

[ Edited ]

_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

Contributor
abhisardeshmukh
Posts: 12
Registered: ‎05-26-2010
My Device: Dev Alpha
My Carrier: Airtel

Re: Is it possible to use .qml in For Creating the native part of the extension Blackberry 10

markwilcox Thanks for reply.....

I testing it on Dev alpha device.....Not on simulator....

I am trying to build shared library not an application.

I tried to catch the exception but nothing is coming. Application gets freeze.....

Please help me to sort out this problem. If needed i can share you the whole code am trying....

Developer
markwilcox
Posts: 51
Registered: ‎11-23-2012
My Device: BB10 Dev Alpha

Re: Is it possible to use .qml in For Creating the native part of the extension Blackberry 10

[ Edited ]

>> 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.

 

Contributor
abhisardeshmukh
Posts: 12
Registered: ‎05-26-2010
My Device: Dev Alpha
My Carrier: Airtel

Re: Is it possible to use .qml in For Creating the native part of the extension Blackberry 10

[ Edited ]

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.......