Choosing the right path
The BlackBerry 10 Native SDK offers two options for bringing your Qt apps over to BlackBerry 10: you can port your existing Qt widget or Qt Quick app directly using Core Native, or you can rebuild or modify your existing app using Cascades. Since Qt is fully supported on BlackBerry 10 you can port an existing Qt app while only making minor changes to your application. If you are interested in getting your Qt app up and running quickly, a direct port is likely your best bet. If you're looking for a rich BlackBerry 10 user experience and deep integration with the platform, Cascades is the framework for you. Cascades is built on a subset of Qt libraries and adds a rich UI framework that lets you create a signature BlackBerry 10 experience. For more information on Cascades, check out the Cascades documentation.
As mentioned above, BlackBerry 10 supports the Qt 4.8 framework and is able to run Qt based applications written in C/C++ and QML. Although the Cascades framework is built on top of the Qt framework, you cannot combine Cascades UI components with either Qt Quick UI components or Qt widgets (UI classes that inherit from QWidget) in an app. This incompatibility occurs because Cascades uses its own scenegraph-based renderer that uses several features which are not supported by Qt4. The following diagram illustrates which modules it shares with Qt, and which modules are exclusive to Qt:
Cascades and Qt UI rendering are mutually exclusive. Cascades and Qt Quick share the use of QtDeclarative, but Cascades does not use the same paint engine as Qt Quick. As a result, you cannot mix Qt widget or Qt Quick UI components with Cascades UI components in the same application. However, you can use Qt modules that do not access the screen in a Cascades app, such as QtCore, QtNetwork, QtXml, and QtSql.
Because of these differences, you must decide on the path you want to take from the outset of your porting project. The following sections aim to offer some assistance in deciding the best route for porting your app.
Using Qt as a part of Core Native
When deciding which approach to take when porting your app to BlackBerry 10, it's important to consider the design of your app and the desired end result for your users. The following list describes a few scenarios where you may decide to port your existing Qt app directly using Core Native, instead of using Cascades.
A heavily customized Qt Quick UI with non-UI Qt code
If you plan to port an app that includes a lot of custom QML components for the UI, your application should work with just some minor changes. Your non-UI Qt code is fully supported, and your custom QML UI should require only a few minor changes to get it looking the way you want on BlackBerry 10.
A heavily customized Qt widget UI with non UI Qt code
If you plan to port an app that includes custom UI components created using Qt widgets, your application should work with just some minor changes. Your non-UI based Qt code is fully supported, and your custom UI should require only minor changes to correct sizing issues. With Qt widgets being designed primarily for desktop use, pay close attention to their usability on BlackBerry 10. You should ensure your controls are large enough, and follow the BlackBerry 10 UI guidelines for placement.
An app with only a few UI elements
If you plan to port an app with a UI that consists of only a few controls, porting as a Qt app might be the option for you. Porting a Qt widget app, and Porting a Qt Quick app offers a step-by-step demonstration of porting apps with few UI elements.
Maximize reuse of Qt code
Porting your Qt app using Core Native allows you to maximize the Qt code you have written for other platforms. In many cases you will be able to get your Qt code up and running on BlackBerry 10 with little to no modification necessary.
Rebuilding or modifying your Qt app using Cascades
The following scenarios describe some instances where choosing to port your application to Cascades might be the path for you.
An app that uses standard Qt Quick or Qt widget UI components
If you plan to port an app that uses mostly standard Qt Quick or Qt widgets, it is recommended that you rebuild your UI using Cascades. Although your Qt Quick based UI will run on BlackBerry 10, Cascades offers UI components specifically designed for the BlackBerry 10 platform. In addition, Cascades offers a large selection of additional APIs that you can use to integrate your app with the device and platform.
An app written using language binding
If you are porting an app that uses either Qt Quick or Qt widgets with third-party language binding (Python, Java, Ruby, Perl, and so on) you will be required to rewrite these parts of your code. If this is the case, it's recommended that you rewrite your application using Cascades. As a best practice, write your UI code using QML, and your business logic using C++ for portability.
You want deep app integration
If you want to increase your app's integration with the BlackBerry 10 platform, consider porting your Qt app to Cascades. In addition to its great selection of core controls, Cascades allows you to integrate with core applications, hardware sensors, and many other platform services.
You want to leverage your Qt C++ and Qt Quick development skills
If you already have experience using Qt and Qt Quick, moving to Cascades should be straight forward. Many of the features will already be familiar to you, and your skills will ensure you get up and running quickly.
You want the look and feel of BlackBerry 10
If you want to incorporate the fluid look and feel of BlackBerry 10, porting to Cascades is the ideal choice. Cascades offers UI controls and components specifically designed for BlackBerry 10, allowing you to create a fluid and engaging user experience.
If any of the above scenarios apply to you, consider taking the time to rewrite your app using Cascades. Not only will you be able to take advantage of deep app integration, but you will also be able to include features unique only to Cascades. For more information on Cascades, check out the Cascades documentation.
Whatever option you choose
No matter which direction you decide to take to port your application, you should always consult the BlackBerry 10 UI guidelines for helpful recommendations for app design. The guidelines contain information about how to size and position controls, as well as how to structure your application. Adhering to these guidelines helps in creating the best overall experience for your users.
For more information on the BlackBerry 10 UI guidelines, see the UI guidelines.