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
Posts: 25
Registered: ‎04-21-2013
My Device: Z10, Z30
Accepted Solution

Very, Very Basic Question about QML....

I'm new to BB10 development and I've been reading over the provided tutorials and reference materials. As the title of my post suggests, I have a very basic question about QML that may have a not so basic answer:

 

Just what exaclty can QML be used for? The literature in the documentation seems to suggest in places that QML is used for scripting UI elements, while the actual work behind the scenes is done by code written in C++. Other documentation seems to hint that an app can be written in QML, although the only examples I've seen of this are apps that really only showcase UI elements.

 

I suppose a shorter question would be: can I write a useful app entirely in QML without ever touching C/C++?

 

On a related note, when someone says they have written the app in "cascades," what are they refering to? Is Cascades the development suite? Is it refering to using QML/C++/QT?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Very, Very Basic Question about QML....

You can think of Cascades as an extension to Qt which allows a more sophisticated UI design specifically for BB10 phones.

 

QML can be thought of, at it's simplest, as a way of describing how you want to place controls on the screen.

Where it gets complicated is the ability to use JavaScript within the QML file itself.

 

So yes it is possible to write entirely competant apps entirely in QML/JavaScript and not write any C++.

 

A good place to start is the free to download development book...

 

http://supportforums.blackberry.com/t5/Social-Lounge/Free-BlackBerry-10-Development-eBook/td-p/28358...


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 16,637
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Very, Very Basic Question about QML....

Qt is a library for c++, and it usually has its own UI components like QtQuick.

BlackBerry decided to replace these with their own UI and called it Cascades.

 

As BBSJDev already pointed out you can develop applications with Cascades only as you can use javascript in there.

Javascript is Touring-Complete, so you can write everything in it. If it is a good idea to do so, well...

----------------------------------------------------------
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
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Very, Very Basic Question about QML....

The way it's designed is to really encourage separating the UI from the application logic. You use QML/JS to handle all the UI stuff, and do the heavy lifting in C++. It's certainly possible to work entirely in QML/JS, or entirely in C++. It depends a lot on your preferences.

 

You can write a useful app entirely or almost entirely in QML. There are some features of Cascades that aren't exposed to QML, and some you just wouldn't want to use there, but you can go a long way without doing any real C++ work.

 

 

 

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Developer
Posts: 68
Registered: ‎12-11-2013
My Device: BlackBerry Z10
My Carrier: Maxis

Re: Very, Very Basic Question about QML....

Although you can create whole application Ui and logic with just qml, you always still need some c++ to start the qml application though this can easily be mastered with so many example. In every qml application, there is a always a main.cpp which is a c++ itself.
Developer
Posts: 120
Registered: ‎02-06-2013
My Device: DAB, DAC, Lost red Z10, Regular Replaced Z10, PlayBook
My Carrier: airtel

Re: Very, Very Basic Question about QML....

Well what I will say be like "small fish big mouth." But I would like to put my perspective about the whole BlackBerry 10 Cascades framework.

You should take the QML file as any HTML.
The way web browser reads the human readable CSS, JavaScript and HTML tags and puts it to the user in some presentable form. BlackBerry framework as well reads the CSS style of elements in QML, JavaScript code (and yeah some few HTML tags as well) same way. (I'm not mapping one-to-one but showing some resemblance between the two)

These codes are accessible to the user from the BAR file in the plain human readable text format same what you find with a HTML file.

Now like any backend Web scripting language viz. PHP, PERL, Python, etc, provide the front end HTML a lot of functionality which is not possible otherwise, similarly CPP file in BB cascades provide many features that can be used by the QML file. Here too, like PHP, PERL, etc, you can't see the source code of a CPP file from the BAR file.

So in short you can say that what HTML file is to web browser, QML file is to BlackBerry engine. It just reads everything from your main.qml file. When you need more features you write CPP code like you write PHP code in web context.

Cascades as the name itself tells you that It has CSS (Cascades Style Sheet) style of coding where Core is purely CPP meant primarily for the Gaming.


Looking for SMTP Servers, Bulk Emails and Bulk SMS services at an affordable price to help boost your business? Look no further. I've the solution for your needs. Contact me now.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Very, Very Basic Question about QML....

@spacena Not sure I agree with all you've put here, firstly CSS stands for Cascading Style Sheets and AFAIK the name Cascades is nothing to do with CSS.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 120
Registered: ‎02-06-2013
My Device: DAB, DAC, Lost red Z10, Regular Replaced Z10, PlayBook
My Carrier: airtel

Re: Very, Very Basic Question about QML....

@BBSJdev, just a typing error, I meant Cascading Style Sheet only :smileyhappy:.

Let me clarify again that It's not what the BlackBerry Cascades is all about. I just wanted to give a final picture on how to go about understanding BlackBerry 10 cascades programming to someone who is new to it. I may be wrong on some of points put above and Cascades may not be CSS but the way we set different properties in CSS viz. height, width, etc, for various HTML elements, in similar fashion we set different attributes to various QML elements.

So main intention was not to say this is like that and so and so but just to provide a perspective that hey this is also how you can understand the platform when you have decided to work on this to create wonderful apps.

I myself am very new to this platform and still discovering it's wonderful and powerful framework.


Looking for SMTP Servers, Bulk Emails and Bulk SMS services at an affordable price to help boost your business? Look no further. I've the solution for your needs. Contact me now.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Very, Very Basic Question about QML....

:smileyhappy: It's always difficult to answer these kind of questions without having some kind of reference on how much knowledge the OP has overall.

If he has none then me referencing JavaScript, Simon mentioning QtQuick and you mentioning CSS won't help him be any less confused. :smileyhappy:

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 25
Registered: ‎04-21-2013
My Device: Z10, Z30

Re: Very, Very Basic Question about QML....

Thank you to everyone that's contributed so far! Your responses, along with some of my own tinkering with QML, have really put into perspective how BB10 development works!