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 APIs, 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, switch to the Cascades focus by using the focus switcher in the upper-left corner of this page.

As mentioned above, BlackBerry 10 supports the Qt 4.8 framework and can run Qt based applications written in C/C++ and QML. Although the Cascades UI 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, which uses several features that Qt 4 doesn't support. The following diagram illustrates the modules Cascades shares with Qt, and which modules are used only in Qt:

Diagram showing the relationship between Cascades and Qt.

Cascades and Qt Quick both use 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 which path you want to take before you start your porting project. Continue reading for help with deciding the best route for porting your app.

Using Qt as a part of core native

As you decide which approach to take when you port your app to BlackBerry 10, it's important to consider the design of your app and the result you want 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 Cascades.

You have a Qt Quick app with a heavily customized UI with non-UI Qt code

If you plan to port an app that includes many custom QML components for the UI, your application should work after some minor changes. Your non-UI Qt code is fully supported, and your custom QML UI should need only a few changes to look the way you want on BlackBerry 10.

You have a Qt widget app with a heavily customized 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 need only minor changes to correct sizing issues. Qt widgets are designed primarily for use on a desktop computer, so 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.

You have 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 your Qt app as a part of core native 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.

You want to maximize reuse of your Qt code

If you want to maximize reuse of your Qt code, porting your app as a part of core native is the option for you. In many cases, you can get your Qt code running on BlackBerry 10 with little or no modification.

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.

You have an app that uses standard Qt Quick or Qt widget UI components

If you plan to port an app that mostly uses standard Qt Quick or Qt widgets, you should rebuild your UI using Cascades. Although your Qt Quick based UI will run on BlackBerry 10, Cascades offers UI components specifically designed for BlackBerry 10 screen resolutions.

You have 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, you should rewrite your application using Cascades. As a best practice, write your UI code using QML and your business logic using C++ for portability across platforms.

You want deep app integration

If you want to increase your app's integration with the features offered by BlackBerry 10, consider porting your Qt app using Cascades. In addition to its wide selection of core controls, Cascades allows you to integrate your app with core applications, hardware sensors, and many other platform services.

You want to leverage your C++ and Qt Quick development skills

If you already have experience using Qt and Qt Quick, moving your app to Cascades should be straightforward. You will already be familiar with many of the features, and your skills will let you get your app 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 includes UI controls and components specifically designed for BlackBerry 10, allowing you to create a seamless 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 can you take advantage of deep app integration, but you can also include features unique only to Cascades in your app.

Regardless of which 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 app design considerations. The guidelines contain information about how to size and position controls, as well as how to structure your application. Adhering to these guidelines can help you create the best overall experience for your users.

Last modified: 2015-03-31

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus