Writing Qt apps for the BlackBerry 10 platform

Cascades

Guest post from Eun-Kyung Choi and Kizito Kasengulu – Ed.

TITLE_IMAGE

Cascades™ and Qt are two major frameworks available on the BlackBerry® 10 platform. Qt on BlackBerry 10 provides a complete set of standard Qt 4.8 APIs with the exception of the QtWebKit module. BlackBerry 10 provides a selected set of APIs from the QtMobility project as well. I will provide an overview of Qt 4.8 APIs coverage on BlackBerry 10, with a focus on APIs that are different or not available on BlackBerry 10, and will refer to alternative Cascades APIs in relevant cases. More details are provided here:
https://developer.blackberry.com/cascades/reference/qt_index.html

To start, I wanted to share two fundamental facts about the use of Qt within Cascades and Qt on BlackBerry 10 in general:

1. Cascades uses its own backend to render on the screen. This backend does not use Qt because Cascades needed several features, which Qt addresses only starting with Qt5. Developers have to decide upfront if an application will use Cascades or Qt to render on the screen, because it is not possible to mix Qt and Cascades APIs to access the screen in one application. Developers can write “pure” Qt Quick or QWidget apps and have the app directly deployed and run on the BlackBerry 10 platform with little or no platform adaptations. Cascades apps can use all Qt APIs which do not access the screen; e.g. the modules QtCore, QtNetwork, QtSql, QtXml.

2. QtMobility APIs have been developed, published and maintained in a separate project outside of the Qt 4.8 base line; therefore QtMobility does not belong to a standard Qt4 package. QtMobility should be separately built and integrated into mobile and embedded platforms based on Qt4. Since the work on QtMobility was focused on standards and services used by Nokia devices, the use of these APIs on modern platforms provided by other vendors requires changes. This applies to the BlackBerry 10 platform as well. The current release of BlackBerry 10 therefore provides a subset of QtMobility API implementation.

In addition to the Cascades UI framework, RIM® has created a rich set of middleware Qt-based APIs to access the key BlackBerry 10 features. Since these APIs do not render to the screen, they can be used in Cascades apps as well as in applications based on Qt widgets and Qt Quick.

Using Qt widgets with C++ on the BlackBerry 10 platform

Qt widgets are fully supported on the platform and included in the BlackBerry 10 NDK. Even though almost no changes in the code are needed to get a Qt widget-based application running on BlackBerry 10, this approach will rarely provide acceptable results. Qt widgets have been developed for desktop applications and only few of them are suitable for a mobile platform. For example, QButton, QCheckBox or QProgressBar can be effectively used, but using QMainWidow or QDialog in an app for a mobile device does not make much sense. Moreover, the implementation of animations and effects in widget based UIs requires considerable effort or can even be not possible in some cases. Cascades and Qt Quick provide much better solutions tailored to use cases on mobile devices.

Qt in the current Beta releases of the NDK and on Dev Alpha devices uses a default style for Qt widgets. The final version will contain a style tailored to the appearance of the BlackBerry 10 native UI elements.

Developing with Qt Quick

Qt Quick 1.1 is fully supported on the BlackBerry 10 platform as a part of Qt 4.8 package. Additional Qt Quick plugins provided in the QtMobility package are supported according to their general availability on BlackBerry 10.

Developers who used Qt Quick on a desktop platform should note that the “qmlviewer” application is not available on BlackBerry 10. The security and deployment models on BlackBerry 10 require using own C++ code to load Qt Quick files. An example of this code in provided in Qt as well as in the template application which can be created in the category “BlackBerry Qt Quick Application” via the “New Project” wizard in QtCreator 2.6 and newer.

Qt Quick applications intensively using animations and transitions should use QGLWidget as a view port in QDeclarativeView. Using QGLWidget will enable hardware acceleration and therefore usually provides better rendering performance.

When it comes to the UI development, Qt Quick is a good choice when an application needs its own custom appearance with a custom set of UI elements, or when the application code should be ported from another platform to BlackBerry 10. Since Qt Quick 1.1 does not provide high-level UI components, developers have to provide an implementation of these UI elements. If an application needs an authentic BlackBerry 10 look-and-feel and a seamless integration with the platform, using Cascades UI framework is a much better approach.

QtMultimedia

This module is deprecated and not supported. Please use QtMultimediaKit from QtMobility instead.

QtOpenGL

QtOpenGL is fully included in the BlackBerry 10 NDK. However, QtOpenGL APIs cannot be used in a Cascades app. Please check the Cascades documentation to find how to use OpenGL in Cascades apps.

QtScriptTools

QtScriptTools is fully included in the BlackBerry 10 NDK. However, QtScriptTools APIs cannot be used in a Cascades app. Cascades apps use QScriptEngine as described in the BlackBerry 10 documentation.

QtSvg

QtSvg is fully included in the BlackBerry 10 NDK. However, QtSvg APIs cannot be used in Cascades apps.

QtWebKit

QtWebKit is not supported, but RIM is planning to include a solution in later releases of BlackBerry 10.

QtTest

QtTest is fully included in the BlackBerry 10 NDK. However, QtTest APIs cannot be used in Cascades apps.

Not supported

  • Phonon
  • Qt3Support
  • QtDesigner
  • QtUiTools
  • QtHelp
  • QAxContainer
  • QAxServer
  • QtDBus

APIs from the Qt Mobility 1.2 project:

QtNetwork

Most of these APIs have been included in the Qt 4.8 and are supported on BlackBerry 10.

QtLocation

A subset of QtLocation is supported by QtLocationSubset. Details about QtLocationSubset can be found at https://developer.blackberry.com/cascades/documentation/device_platform/location/

QtMultimediaKit

The QtMultimediaKit module is included in the BlackBerry 10 NDK except for QMediaRecorderControl (and so no QMediaRecorder) and Camera APIs. Development teams in RIM are working to provide support for these and other modules in the future. It is important to note that QtMultimedia APIs in Qt 4.8 have dependencies on the QtGui module and so they cannot be used in Cascades apps. Cascades app should use MediaPlayer APIs instead.

QtSensors

The QtSensors module is fully included in the BlackBerry 10 NDK. RIM has extended the default API set with new and useful features. Most QtSensors APIs can be used in Cascades apps. The exact list of supported APIs is available in
https://developer.blackberry.com/cascades/documentation/device_comm/sensors/index.html

QtConnectivity

RIM is currently working on adding support for NFC and Bluetooth®. BlackBerry 10 also provides the QtNfcSubset module which provides access to NFC on enabled BlackBerry 10 devices. More details will be provided in the BlackBerry 10 documentation.

Following modules are not supported:

  • QtServiceFramework
  • QtContacts
  • QtMessaging
  • QtSystemInfo
  • QtPublishSubscribe
  • QtOrganizer
  • QtFeedback
  • QtGallery
  • QtVersit

Related Resources

We are planning to provide more detailed documentation about Qt applications on BlackBerry 10 in the next blog posts. In the meantime, please find below some selected links related to Qt on BlackBerry 10:

Related Posts:

Happy Qt development for BlackBerry 10! Please note that RIM is committed to Qt and is continuously working to expand the selection of own add-on modules as well as standard modules provided by Qt in the future.

About EunKyung

Application Development Consultant at BlackBerry

Join the conversation

Show comments Hide comments
+ -
blog comments powered by Disqus