MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Application development framework

The MeeGo 1.2 Harmattan architecture is designed on the solid foundation of best-of-breed open source tools. In the Harmattan world, applications exist on top of the Qt middleware layer and can access platform services, such as PulseAudio or OpenGL directly.

Applications in Harmattan architecture

Typically, Harmattan applications are written with C/C++, and the user interface is developed with QML (recommended), HTML, or C++.

UI frameworks

It is recommended to use the following UI frameworks for Harmattan applications:

When porting existing applications, you can either rewrite the UI of your application using one of the recommended frameworks or continue developing with the following frameworks with some limitations:

  • plain Qt Quick
  • QGraphicsView
  • QWidget (not recommended)

You can also utilise the tools provided by Imagination Technologies in your graphics development.

Qt Quick Components

The best way to create a user interface for your Harmattan application is to take advantage of Qt Quick Components, a set of Qt Meta-Object Language (QML)-based widgets and other elements that you can use as building blocks to create a UI that matches the native look and feel of the Harmattan device. Qt Quick Components are provided as a library in Harmattan API.

Qt Quick Components are easy to use, enable writing customised and dynamic user interfaces with smooth transitions, and have good tool support. After importing the Qt Quick Components module, you can use the components in the same way as standard QML elements.

Qt Quick Components allow you to use:

  • QML, a declarative, script-like markup language that is easy to learn for UI designers familiar with web UI tools.
  • Qt Declarative, a module that provides the run-time interpreter for QML UIs and enables extending them with C++ code.
  • ready-made templates in Qt Creator:
    • The Qt Quick Application template creates a project skeleton for an application that includes both C++ files and a QML file. When using this template, you can start creating a UI with Qt Quick Components right away.
    • The Qt Quick UI template creates a QML file that you can test and debug with QML Viewer without compiling.

For more information, see:

Using QML

QML is a declarative language that describes how a UI behaves and what it looks like. In QML, a UI is specified as a tree of objects with properties. QML does not entirely replace native Qt/C++ development but it augments it. The main purpose of QML is to define the UI layout, states, and transitions. To further define the UI behaviour, use JavaScript embedded in QML.

However, even though QML with Javascript is a powerful language, in some cases it is better to use QML and Qt Quick Components to define the UI and implement the program logic in Qt/C++. The classes in the Qt Declarative module allow you to load and manipulate QML Components from C++, and through Qt's meta-object system, QML and C++ objects can easily communicate through Qt signals and slots. You can also write QML plug-ins to create reusable QML Components for distribution. Note that you still need a piece of boilerplate C++ for deployment if the application is pure QML.

For more information, see Qt documentation:

QtWebKit

QtWebKit allows you to develop modern HTML5 applications for Harmattan. QtWebKit is Nokia's version of the open source WebKit layout engine, ported to Qt. It is used to render HTML content and execute JavaScript.

To develop Harmattan applications with QtWebKit, you can:

  • Create a Qt Quick Components application and use the QML WebView element to show the actual web content.
  • Create a C++ MeeGo Touch application and use the QGraphicsWebView class.

For more information, see QtWebKit documentation provided by Qt.

OpenGL ES

The OpenGL ES API is commonly used in developing mobile applications, and OpenGL ES applications are easy to port from iOS and Android to Harmattan. Harmattan devices provide hardware acceleration for OpenGL ES.

OpenGL ES 2.0 is the primary graphics API for Harmattan. It is also used by most other handheld and tablet devices, so when porting applications to or from other platforms, you may not need to modify the rendering code at all. For more information, see OpenGL ES 2.0 on the Khronos website.

OpenGL ES 1.1 is a legacy version of the Khronos standard graphics API, supported primarily by devices of the past, such as Nokia N95 and iPhones before 3GS. Harmattan supports this primarily to make it easier to port legacy applications to or from Harmattan. For more information, see OpenGL ES 1.1 on the Khronos website.

Note: Before you start to develop accelerated graphics, open a full-screen non-composed window on your Harmattan device.

QtOpenGL

QtOpenGL allows you to use the OpenGL API for rendering 3D graphics. You can use the OpenGL widget class just like any other Qt widget, except that it opens an OpenGL display buffer where you can use the OpenGL API to render the contents.

For more information, see QtOpenGL API in MeeGo 1.2 Harmattan API reference.

MeeGo Touch

MeeGo Touch Framework is built on top of the Qt Graphics View framework and customised for Harmattan. MeeGo Touch Framework provides all the necessary building blocks for creating native Harmattan UI applications, including standardised window navigation, list and other widget behaviour, and common theming for components.

MeeGo Touch Framework is part of Platform API, which may not be compatible with future Harmattan updates. For more information, see libmeegotouch library in Platform API reference.

Note: Libraries included in Platform API may change between Harmattan release updates. Therefore, you must update applications using MeeGo Touch Framework accordingly.

QWidget, QGraphicsView, and plain Qt Quick

In addition to the above-mentioned UI frameworks that are optimised for Harmattan, you can also use the standard cross-platform technologies of Qt for developing Harmattan applications. This is especially useful when porting existing applications from other platforms.

For plain Qt Quick applications, it is recommended to create a Qt Quick Components wrapper and place your existing code within the Page elements. For QGraphicsView applications, create a corresponding MeeGo Touch wrapper.

If you use these technologies without Qt Quick Components or MeeGo Touch frameworks, the following limitations apply to your Harmattan application:

  • Portrait/landscape orientation control is limited:
    • Default orientation is landscape.
    • If the UI orientation is portrait, the application needs to be in the full-screen mode (that is, without the status bar).
  • The UI elements do not match the Harmattan native look and feel.
  • The virtual keyboard is always shown in the landscape mode.

Note: Using QWidget is not recommended, because the UI elements are too small and not suitable for touch-screen interaction.

API highlights

Harmattan platform provides a wide selection of APIs for application development. A subset of the APIs is compatible with the open-source MeeGo project. For more information, see MeeGo API reference.

The following section highlights Harmattan APIs that are especially versatile, making them suitable for a range of applications. If you want to utilise the multimedia features of Harmattan, see Multimedia API overview.

Note: For the full list of stable Harmattan APIs, see MeeGo 1.2 Harmattan API reference.

QtGames API

QtGames API provides hardware scaling and advanced debugging features that are especially targeted at mobile game development and porting. The library has been built on Qt, but it is primarily intended for native C++ development or porting.

For more information, see QtGames API in MeeGo 1.2 Harmattan API reference.

Qt Mobility

Qt Mobility APIs allow you to build and maintain a single application which can be deployed across several mobile (and desktop) platforms. Qt Mobility APIs provide standard mobile functionalities for your application, such as:

  • location and map services
  • camera features
  • hardware sensor data
  • system information
  • Near Field Communications (NFC) features
  • common services in mobile environments, such as messaging, contacts, and multimedia

For more information, see Qt Mobility APIs in MeeGo 1.2 Harmattan API reference.

PulseAudio

PulseAudio APIs provide applications with different types of sound features, such as:

  • volume control
  • support for multiple audio sources
  • ability to play sound through different output devices
  • ability to record sound

For more information, see:

GStreamer

GStreamer is a multimedia framework that uses GLib as its core library. You can use this framework for developing applications with multimedia features, such as live-streaming.

For more information, see:

Accounts and Single Sign-On

Accounts and Single Sign-On API allows applications to retrieve, edit, and create accounts and list the currently installed account providers and services. Different processes can operate simultaneously on the same data.

For more information, see Accounts API in MeeGo 1.2 Harmattan API reference.