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
Developer
annadanesh
Posts: 82
Registered: ‎01-11-2013
My Device: DevAlphadevice

issue with setContextProperty

Hi ,

 

ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
                                QObject(app) {

   QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("_app", this);
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    app->setScene(root);

}

 

by this setContextProperty("_app", this); code i calling Q_Invokable functions defined in ApplicationUI class from main.qml  .

 

my app flow is :

 

1>ApplicationUI to main.qml

2>from main.qml calling some server request Q_Invokable methods in ApplicationUI c++ class

3>from server response drawing listview in  customlist class in c++

4>in listview i am having back button onclick ,am going back to main.qml

5>again calling Q_Invokable  methods of ApplicationUI c++ class using _app variable set in setContextProperty("_app", this); in above code

 

my issue is i am not able to run 5th staement ,getting error that unrefernced variable error _app so plz anybody help to slove this .

 

 

 

 

 

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: issue with setContextProperty

is 2 and 5 the same place in your main.qml?

what does error exactly say and where do you get it? in console?

Developer
annadanesh
Posts: 82
Registered: ‎01-11-2013
My Device: DevAlphadevice

Re: issue with setContextProperty

ya ,

 

2 and 5 are same main.qml class.

 

i am getting this error in device log ,in 2 case app variable is working fine as project open main.qml is called, but in 5 case am not able to call Q_Incokable methods using same app variable .

Developer
annadanesh
Posts: 82
Registered: ‎01-11-2013
My Device: DevAlphadevice

Re: issue with setContextProperty

 if anybody knows solution plz help me