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

Posts: 27
Registered: ‎07-16-2012
My Device: BlackBerry 10 Dev Alpha
My Carrier: M1

Cascades QML and C++ communication


  I've read the documentation at: https://developer.blackberry.com/cascades/documentation/dev/integrating_cpp_qml/ but it doesn't have the answer I am looking for.


  I need a way to change the title text on a Header component in QML from C++. My problem is that I have a few QML files. And the Header component title value I wish to modify from C++ is not defined in the first (root) QML file. Rather, it is defined in another qml file that is dynamically created from an attached object in the first qml file upon a trigger, like a click event. 


  In this case, how is the Header component of the 2nd QML file accessible from C++? Thanks for your help.







Posts: 16,897
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Cascades QML and C++ communication

If the component is created it should be obtainable by findChild.
You could also connect a signal from c++ to qml, for example in the onCreationCompleted of the qml component.
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 19
Registered: ‎03-28-2013
My Device: www
My Carrier: www

Re: Cascades QML and C++ communication

I think you should not use attached object. Create the qml file  directly on response the signal in the .cpp file. Use the

qml->setContextProperty()  to set text.