A closer look at BlackBerry 10 Cascades SDK

published at 28.01.2013 16:29 by Jens Weller
Save to Instapaper Pocket

The past weeks I looked again at the BlackBerry 10 Cascades SDK for native development in C++ and Qt for BlackBerry 10. BlackBerry 10 is BlackBerrys new OS launched this weeks Wednesday. I already did take a look last October at the BlackBerry SDK, but was to busy with preparations for the Meeting C++ Conference. Now after about 2 weeks of learning Cascades QML + Qt on BlackBerry 10, I decided to start a BB10 Tutorial Series on Youtube, sharing some of my expierences with the Cascades SDK and giving people a hint on how to start the development for their own Apps for BB10.

Getting Started. Sometime ago I made the decision, that basicly every SDK I would develop for, had to run in its own Virtual Machine, rather then on my normal host machine. That makes the setup a bit more tricky, but has the advantage, that the SDKs live each in their own little machine, rather then cluttering my host machine and getting in the way of each other. I choose Virtual Box as the Virtual Machine host on Windows7 and Linux Mint as the guest OS. To get started, simply download the Cascades SDK and the Simulator from the BlackBerry Developer page. The Simulator requires to install the free VMWare Player, as its setup for VMWare. In my setup the Simulator runs under Windows. Once you have installed the SDK, you can start the Momentics IDE, the eclipse based IDE is the preferred way to develop for BB10 with the Cascades SDK. Once you create your first project you will be guided through the BlackBerry Deployment Setup Wizard, which lets you set the connection to your simulator or device, lets you create you signing keys and upload your debuging tokens to your device. Once the wizard completes, you should be ready to start your first app.

In the 2nd part of my BB10 tutorial I show how to connect the Cascades QML UI Frontend to the C++ Backend, which is build with Qt. It is fairly easy to connect QML and Qt, to let both parts of the application communicate. Actualy, this is not BB10 specific, it can be used almost the same way in Qt5! To let QML access an instance of a QObject derived class, simply add it to the corresponding QmlDocument in BB10:


Now, in QML myObj is registered as an instance of myObj, and you will be able to call methods marked with Q_INVOKABLE or access the objects properties. It is also possible to communicate via signals, you can connect to Signals from QML and C++, and you also can define and emit them from both sides.

In the 3rd part of my tutorial, I took a look at the Cascades API Documentation. Cascades is build on top of Qt, and therefore offers a lot of Qt classes to work with. For now, the Cascades SDK is based on Qt 4.8, but a later update to Qt 5 is planned for this year. I choose to implement a short examlpe for using the Cascades App Integration API with the calendar. My little App lists the next and previous Events of the last and coming 30 days. This is fairly easy to achieve:

bb::pim::calendar::CalendarService calService;
bb::pim::calendar::Result::Type result_type;

bb::pim::calendar::EventSearchParameters next;
QDateTime now = QDateTime::currentDateTime();

QList<bb::pim::calendar::CalendarEvent> eventList =
if(result_type != -1)
    foreach(const bb::pim::calendar::CalendarEvent& event, eventList)
        next_events.append(event.startTime().toString("h:mm dd.MM.yy ")
                + event.subject());

You first have to create an object of CalendarService, and set up your search query, which events would like to see from the Calendar? In this case it is the next 30 days. CalendarService gives back a QList of CalendarEvent Objects, which are added to a local String model. In the next part I will focus on how to use the Models in Cascades, as simply putting Strings in Lists is very limiting.

And here is the code for download:

Part I + Part II

Part III

Join the Meeting C++ patreon community!
This and other posts on Meeting C++ are enabled by my supporters on patreon!