Wednesday, 15 February 2012

QTHelloWorld in Momentics IDE for Blackberry Playbook

1. Build QT library for Playbook Simulator
For simplicity let's assume you are using /qt-x86-lib folder (x86 because you are building for Simulator)
$ cd /qt-x86-lib
$ git clone
...git will work here for you...
$ cd Qt

My Momentics IDE is installed in /Developer/SDKs/bbndk-2.0/, adjust the next line according to your setup.
$ source /Developer/SDKs/bbndk-2.0/
$ ./configure-qsk x86
...lot's of output...
$ make
... here you can go drink some coffee/beer/whatever you prefer/watch favorite movie...
$ make install
...lot's of output...

At this point you should have all QT libraries compiled for x86 architecture. Let's check it.
$ ls -l /qt-x86-lib/Qt/stage/nto/x86/usr/lib/qt4/lib
drwxr-xr-x  84 eyurchen  domusers      2856 Feb  9 14:28 fonts
-rw-r--r--   1 eyurchen  domusers       922 Feb 10 11:13
-rw-r--r--   1 eyurchen  domusers       872 Feb 10 11:13 libQtCore.prl
lrwxr-xr-x   1 eyurchen  domusers        18 Feb 10 11:13 ->
lrwxr-xr-x   1 eyurchen  domusers        18 Feb 10 11:13 ->
lrwxr-xr-x   1 eyurchen  domusers        18 Feb 10 11:13 ->
-rwxr-xr-x   1 eyurchen  domusers   3193036 Feb 10 11:13
You should have similar output.

2. Create QTHelloWorld project in Momentics IDE
Download/Install/Start Momentics 2.0
Click File->New->BlackBerry Tablet OS C/C++ Project and in Project Name: specify QTHelloWorld, hit Next and Basic Setting will open.
- check Language: C++
- Build Style: Managed build
- Project Type: Application-Empty Application
Click Next and Build Configurations will open, we want Simulator-Debug here. Click Finish.
At this point we have an empty project with bar-descriptor opened for you in IDE. You can put whatever you want at General Page:

Click Assets tab and then make sure to select Simulator-Debug at Build Configurations panel. Then click Add Files... then File System... and select your library that you built in /qt-x86-lib/Qt/stage/nto/x86/usr/lib/qt4/lib. Do the same for, Now add one more file: /qt-x86-lib/Qt/stage/nto/x86/usr/lib/qt4/plugins/platforms/ Now you should have picture similar to this:

Now we have to correct one line in bar-descriptor.xml. Click on Source tab and locate the line
<asset path="/qt-x86-lib/Qt/stage/nto/x86/usr/lib/qt4/plugins/platforms/" type="Qnx/Elf">lib/</asset>

Change it to:
<asset path="/qt-x86-lib/Qt/stage/nto/x86/usr/lib/qt4/plugins/platforms/" type="Qnx/Elf">lib/platforms/</asset>
Click File->Save all...

Now let's add source file main.cpp to the project. Right click on src folder in Project Explorer and choos New->Source file, in Source File: field put main.cpp and hit Finish.

Main.cpp will be opened for you, copy paste following code:

#include <QApplication>
#include <QPushButton>
#include <QWidget>

int main(int argc, char *argv[])
    QApplication app(argc, argv);

    QWidget window;
    window.resize(1024, 600);

    QPushButton quit("Quit", &window);
    quit.setGeometry(422, 100, 180, 40);
    QObject::connect(&quit, SIGNAL(clicked()), &app, SLOT(quit()));;
    return app.exec();
Click File->Save all...

Now it is time to change some compiler/linker settings. Right click on QTHelloWorld in Project Explorer and choose Properties. Make sure you set up right things in Configuration:, Include Directories (-l) and Defines (-D) as shown on the picture:

Now set up your libraries this way:

Click Ok.
Let's try to build - click Project->Build Project. In Console you should eventually see "Build complete for project QTHelloWorld". Congratulations! it's already something... Now hit Run->Debug and after the project is packaged and deployed to your Simulator you will be switched to Debug Perspective and the program execution will stop at main().

Now you know what to do -) Enjoy!

PS: many thanks to who gave me the very first hint how to start.


  1. Thank you for this great tutorial. I've followed it step by step and I've managed to compile my application. But when I wanted to run/debug it I got the following error: "Failed to load platform plugin "". Available platforms are: blackberry". To fix this I had to add "-platform blackberry" on the configuration arguments tab.
    But I still have problems. Now when I try to run/debug it I get the following error: "QBB: failed to open Locale pps, errno=13
    QFontDatabase: Cannot find font directory /path/Qt/stage/nto/x86/usr/lib/qt4/lib/fonts - is Qt installed correctly?". And the fonts directory is at the specified location.

    Any ideas?


  2. After adding "< env var="QT_QPA_FONTDIR" value="/usr/fonts/font_repository/liberation" / >" in the bar-descriptor.xml file I am able to run/debug the application. I still have the "QBB: failed to open Locale pps, errno=13" logged, but the application seems to run just fine.


  3. Another thing - for those getting unresolved inclusions ("Unresolved inclusion: < QApplication >") and no autocompletion - just go to Properties->C/C++ General->Indexer and select in the "Build configuration for indexer" the configuration you're working with.


  4. Another 'workaround' about fonts is to put it in your code:
    qputenv("QT_QPA_FONTDIR", "/usr/fonts/font_repository/monotype");

    And regarding 'unresolved inclusions' - yes you are right, thanks. Though it does not affect your ability to compile/run the program. It's just nice feature of IDE to highlight different things.

  5. Wow... this one completes my effort to compile and build qt framework app on my pb...

    Actually, I have a game build for Nokia's QtQuick (QML). I'm finding possibilities to port it... Anyone knows how far QML is supported and how it is rendered?

    1. You might wish to take a look at

  6. I am getting error in console like
    Failed to load platform plugin "". Available platforms are:

    Please help me.
    I am totally new to develop application on playbook with QT.

    1. To my knowledge these two issues will result in what you are seeing:
      - is correctly set in Assets like:

      - you have QtOpenGL in libraries.

  7. Hello
    All the other errors are sorted. I am able to deploy the application from Momentics. But still I am not able to launch the application on simulator.
    Its not giving me any kind of error. Icon of the application is displayed on the simulator but after clicking on icon its not showing the splashscrren.
    What can be the error, or which thing I am missing.

  8. I am getting the error while building the project from Qt creator for the playbook simulator. I hd followed steps to build project from the Qt web help

    Also tried with the Qtcreator and command line

    17:24:47: Running steps for project QTGod...
    17:24:47: Configuration unchanged, skipping qmake step.
    17:24:47: Starting: "/usr/bin/make" clean -w
    make: Entering directory `/Users/css/ndk-2.1.0-workspace/QTGod'
    rm -f main.o
    rm -f *~ core *.core
    make: Leaving directory `/Users/css/ndk-2.1.0-workspace/QTGod'
    17:24:47: The process "/usr/bin/make" exited normally.
    17:24:55: Could not find packager command '%s' in the build environment
    Error while building/deploying project QTGod (target: QNX x86)
    When executing step 'Create Bar package'

    Please help me to resolve my problem.

  9. I get a D:/bbndk-2.1.0/target/qnx6/armle-v7/usr/lib/qt4/lib/ undefined reference to `QGLContextPrivate::swapRegion(QRegion const&)'.

    Adding QtOpenGL to the qcc linker libraries results in an error when compiling the application for me. Work around was to replace QtOpenGL in the qcc linker libraries list with EGL. The file still need to be included in the assets though.