MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Introduction to the Qt Quick components

The Qt Quick components are built on top of Qt Quick and provide native-look user interface elements for your QML-based applications. They are bundled together as a module that you can import into your QML file. Once you have imported the components module, you can use the components just as you would use standard QML elements such as Rectangle and Text. As with normal QML applications, you can still use JavaScript and/or Qt C++ for the business logic of your application.

Cross-Platform Development

The components are implemented separately for both Symbian and MeeGo 1.2 Harmattan. This has been done so that they can be easily made to match the native look and feel of each platform. In order to keep the implementations compatible, there is a common API definition that each implementation must comply with. This means you can use components based on the common APIs for your application interface and it will work on both platforms.

However, a platform often has ways of doing things that are particular to that platform. During the development of the components, a design decision was made to implement these platform-specific features as extensions to the common APIs or as separate components where appropriate. This keeps the common APIs small and streamlined rather than becoming bloated by all the little bits and pieces special for every platform. So, when developing an application, you can develop the core of your user interface in a cross- platform manner. After you have that done, optimise your the interface to take advantage of features specific to each particular platform. In practice, this means you need to create separate variant files for the parts of your application that use platform-specific features. However, these differences are generally small and, due to the declarative nature of the QML language, it is fast to create these variants.

  • Common API components - These APIs are common to each platform and auto-tests ensure that each platform conforms to these standardised APIs.
  • Common API components with platform-specific extensions - These are properties, methods and signals that extend a common API and are only available on a particular platform. They are identified by "platform" at the start of the name.
  • Platform-specific components - These components are only available for a particular platform.

Using the Components

You can use the Qt Quick components in your QML application with one of the following imports at the top of your QML document:

 import com.nokia.meego      // MeeGo 1.2 Harmattan components

When using components it is necessary to use Window or PageStackWindow component as a base component for the application. If those are not used some of the features provided by the Qt Quick Components does not work.

There is also a cross-platform import in development but you should consider it as "experimental" for now. Do not be surprised if it does not work how you might expect.

 import Qt.labs.components.native 1.0  // Qt Quick components