Getting Started with Qt for BlackBerry 10 | Qt 5.4

- Qt 5.4
- Getting Started with Qt for BlackBerry 10
- Qt 5.4.2 Reference Documentation

# Getting Started with Qt for BlackBerry 10

## Development with Qt for BlackBerry 10

Development of Qt applications for the BlackBerry 10 platform is possible using the BlackBerry Native Development Kit. First versions of NDK contained both, the Momentics IDE as well as the NDK itself. In recent releases, developers have to download the Momentics IDE first, which then installs the NDK and simulator packages. Every NDK package includes a cross compiler toolchain, plus packaging and deployment tools, basically all you need for development.

## Initial Preparation

### Get a BlackBerry ID

The BlackBerry ID is used as an identity reference and is necessary to register as a developer and use the device in developer mode. You can create a BlackBerry ID online. If you already use a BlackBerry device, you should have a BlackBerry ID, as well. It is the same ID used in BBM or to download apps from BlackBerry World. If you have such an ID you can use it to get a BlackBerry ID token for development.

### Get the Momentics IDE

First download the Momentics IDE, set it up and download an NDK with appropriate API level, see this article for more details.

## Setup

### Enable the Development Mode on the Device

Make sure your device is connected to your computer. Switch on Development Mode in Settings -> Security and Privacy -> Development Mode.

### Install Momentics

Install the Momentics IDE by executing

    cd ~/Downloads/
    chmod +x momentics-<your-version>.bin
    ./momentics-<your-version>.bin

Install the suggested API level. Other API levels can be added later. Select Manage Devices from the Devices drop-down menu. Create and Download the BlackBerry ID token needed for deployment and testing. Enter your company name and choose a password. Log in with your Black Berry ID and password in the pop-up window. Click Next and Finish to generate a debug token and deploy it to your device.

Qt Creator 3.0 and later support the BlackBerry ID token and debug token management as well.

## Verify Your Setup with a Sample App

### In the Momentics IDE

Select a sample application in the Momentics IDE and click Download and Import. This will download the sample and create a new project. Hit the green play button in Momentics to run the application on your BlackBerry 10 device. The application will now start on your BlackBerry 10 device.

### In Qt Creator

See the article Qt Creator with BlackBerry 10. Qt Creator 2.7 and later contain a plug-in which integrates the BlackBerry 10 NDK and its tools into the development process as it is know to Qt Creator users.

## Simulator

You can download the Simulator from the Momentics IDE via the Devices menu. Select Manage devices from the main toolbar in Momentics and switch to the Simulator tab. The Simulator is available as separate download. For more details, see the this article on the developer page. Installing the Simulator is optional. You most probably will test and deploy applications on a BlackBerry 10 device directly, but sometimes using the Simulator is more convenient. It also allows testing of your app on a configuration of a device which you do not have.

If you work on the command line and use Qt 5.2 or later you have change the CPUVARDIR environment variable to switch to Simulator as target:

    export CPUVARDIR=x86

Going back to the device target:

    export CPUVARDIR=armle-v7

Certainly you have to re-run qmake each time you change CPUVARDIR.

Note: You need to have VMware Player installed on your machine to run BlackBerry 10 Simulator.