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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 83
Registered: ‎02-18-2013
My Device: Blackberry 10
My Carrier: airtel

How to get string value from c++ file to qml file in blackberry 10 cascades?

I am call a function from App.cpp.In that function a QString variable value is set.I want this value in main.qml because depends on this string value I want to perform several task in main.qml. Please help me .......Smiley Happy Thanks in advance.

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: How to get string value from c++ file to qml file in blackberry 10 cascades?

You can "export" the value from C++ to QML using QDeclarativePropertyMap or using a PROPERTY

Please check http://developer.blackberry.com/cascades/documentation/dev/integrating_cpp_qml/index.html

Developer
Posts: 83
Registered: ‎02-18-2013
My Device: Blackberry 10
My Carrier: airtel

Re: How to get string value from c++ file to qml file in blackberry 10 cascades?

Thanks for your feedback.

Developer
Posts: 65
Registered: ‎03-20-2013
My Device: Z10(Red Limited Edition)
My Carrier: MY COMPANY

Re: How to get string value from c++ file to qml file in blackberry 10 cascades?

Make that function Q_INVOKABLE like

in App.hpp

define a function like:

Q_INVOKABLE QString getValue();

 

and then in the constructor of

QmlDocument *qml = QmlDocument::create("asset:///main.qml");
qml->setContextProperty("app",app);
 
and you can use this function in main.qml like
app.getValue()

 

Highlighted
Developer
Posts: 83
Registered: ‎02-18-2013
My Device: Blackberry 10
My Carrier: airtel

Re: How to get string value from c++ file to qml file in blackberry 10 cascades?

I get the string value in qml from cpp.I just call a function of cpp file which is emit the signal to the qml.I am just use the qmlRegisterType.

 

Thanks every one.......Smiley Happy for your feedback.........