1 of 16

TTOW0610 Mobile Application Development

Robert Vasek

Peter Seliga

2 of 16

Content

  1. About Qt & what is QML
  2. Small demo from QtCreator
  3. Deployment
  4. Building Qt from source
  5. Deploying Qt to Android
  6. ActivityManager
  7. Pros and cons of Qt on Android

3 of 16

Qt & Android

Qt is a cross-platform application development framework for desktop, embedded and mobile.

Framework written in C++� -MOC (Meta-Object Compiler)

Qt 5 on Android v4.1 (API level 16) or later

Signals & Slots

4 of 16

QML

Qt Meta Language or Qt Modeling Language

Developed within the Qt framework in Qt Quick kit

Markup language for user interfaces� - composed of tags called elements

JSON/HTML/CSS-like & supports inline JavaScript

5 of 16

6 of 16

7 of 16

8 of 16

Deployment

  • Qt is multi-platform - its binaries are not
  • Your phone most likely runs on ARM
  • Cross-compilation

(precompiled version can be found at www.qt.io)

9 of 16

Building Qt from source - prerequisites

  • C++ compiler (g++ / clang / mingw)
  • git
  • Android SDK (from Android Studio)
  • Android NDK
  • OpenJDK

10 of 16

Building Qt from source

More info at https://wiki.qt.io/Android

$ git clone git://code.qt.io/qt/qt5.git

$ cd qt5; ./init-repository

$ ./configure -xplatform android-g++ -android-arch x86 \� -android-toolchain-version 4.9 \� -android-ndk-host linux-x86_64 -android-ndk … -android-sdk …

$ make && sudo make install

11 of 16

Deploying Qt to Android

  • Add the Android Qt Kit to Qt Creator
  • Create a new project
  • Do some work
  • (optional) Switch your current kit to Android
  • You better have an x86 Android emulator - otherwise expect slow performance
  • Deployment:
    • Build -> Deploy project
    • Select an Android device
    • Launch the app on your device

12 of 16

13 of 16

ActivityManager

Why

  • No compact way of switching between application screens
  • No compact way of transferring data between application screens

Capabilities

  • Stack of activities
  • goTo(), goBack() - specifies what QML file to run and display at runtime
  • getData() - retrieves saved data from any activity in the stack
  • setData() - sets data for an activity in the stack

14 of 16

15 of 16

Pros and cons of Qt on Android

  • You’re working on a multi-platform project
  • Your application is computationally demanding
  • You want better performance (AKA lower power consumption)

  • A bit difficult to set up (but once you do, it’s just like anything else)
  • Some capabilities may be missing and need to be added by yourself

16 of 16

Thank you for your attention