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
Posts: 20
Registered: ‎11-12-2012
My Device: Q10 SQN100-1
My Carrier: Rogers

New to cascades and QML

Hi everyone,

 

I'm a ex android developer, although simple apps nothing complex and self taught myself to code on that. 

 

I seem to be having troubles self teaching myself QML and Cascades however. I have my GUI pretty much set up ready to go, I'm just having trouble and figuring out how to implement API's from Facebook and Twitter.

 

I have my application set up on each of the social sites respectively and that's where I'm at a loss on how to input the code needed for a user to log in and pull simple News Feed and Timeline information within my application.

 

Also when using the IDE I try to follow some tutorials, and I've added pretty much every library into my app to make my life easy, yet when i do something like 

import bb.data 1.0

 it gives me a error that it's not installed and its honest to god driving me nuts. Any help is greatly appreciated.

BerryLeaks Co-Founder


Developer
Posts: 115
Registered: ‎10-22-2012
My Device: Developer
My Carrier: Mobifone

Re: New to cascades and QML

Register the type you want to use in QML by call function

qmlRegisterType<bb::data&colon;:DataSource>();

or

bb::data&colon;:DataSource::registerQmlTypes();

before you create QmlDocument. In addition, add

LIBS += -lbbdata

 to your .pro file.

 

See here:

https://github.com/blackberry/Cascades-Samples/blob/master/quotes/quotes.pro

https://github.com/blackberry/Cascades-Samples/blob/master/quotes/src/quotesapp.cpp

 



Like my answer if it's helpful. Mark as answer if it help you solve the problem.
Contributor
Posts: 20
Registered: ‎11-12-2012
My Device: Q10 SQN100-1
My Carrier: Rogers

Re: New to cascades and QML

so should i be deleting my main.qml file than update the .pro file and re add my main.qml?

BerryLeaks Co-Founder


Developer
Posts: 115
Registered: ‎10-22-2012
My Device: Developer
My Carrier: Mobifone

Re: New to cascades and QML

[ Edited ]

No, update the .pro file and:
Add these line

qmlRegisterType < bb::data&colon;:DataSource > ();

or

bb::data&colon;:DataSource::registerQmlTypes();

before the line

Application app(argc, argv);

 in main.cpp

 

Forum post has some error, replace &colon; with :

 



Like my answer if it's helpful. Mark as answer if it help you solve the problem.
Developer
Posts: 115
Registered: ‎10-22-2012
My Device: Developer
My Carrier: Mobifone

Re: New to cascades and QML

DataSource in my case, you should replace it with the class you want to use


Like my answer if it's helpful. Mark as answer if it help you solve the problem.
Contributor
Posts: 20
Registered: ‎11-12-2012
My Device: Q10 SQN100-1
My Carrier: Rogers

Re: New to cascades and QML

perfect thank you i'll give this a try

BerryLeaks Co-Founder


Contributor
Posts: 20
Registered: ‎11-12-2012
My Device: Q10 SQN100-1
My Carrier: Rogers

Re: New to cascades and QML

So when I add that line of code into my main.cpp it gives a error when trying to build the file

BerryLeaks Co-Founder


Developer
Posts: 115
Registered: ‎10-22-2012
My Device: Developer
My Carrier: Mobifone

Re: New to cascades and QML

[ Edited ]

What's the error?

Adding this line

#include <Qt/qdeclarative.h>

 to the top of main.cpp but under the line

#include <QLocale>
#include <QTranslator>

 may help



Like my answer if it's helpful. Mark as answer if it help you solve the problem.
Contributor
Posts: 20
Registered: ‎11-12-2012
My Device: Q10 SQN100-1
My Carrier: Rogers

Re: New to cascades and QML

see screen for the error it gives even after adding that other line 

 

https://dl.dropboxusercontent.com/u/64894815/error.png

BerryLeaks Co-Founder


Developer
Posts: 115
Registered: ‎10-22-2012
My Device: Developer
My Carrier: Mobifone

Re: New to cascades and QML

[ Edited ]

Forum post has some error, so please replace &colon; with :

 

#include <Qt/qdeclarative.h>

#include <bb/data/DataSource>
 
or you can post your file here, I'll edit it for you


Like my answer if it's helpful. Mark as answer if it help you solve the problem.