summaryrefslogtreecommitdiffstats
path: root/README
blob: e58336eb2177c72ce6161d17575d68e2fa19665b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# QML for Android

QML wrappers for native Android controls.

## Introduction

This is a former Qt hackathon project born in November 2014.
Credits for the original idea and the groundwork go to Attila Csipa:
- http://achipa.blogspot.no/2014/11/qml-wrappers-for-native-android.html
- http://achipa.blogspot.no/2014/11/native-ui-in-qt-on-android-without.html

## Requirements

- Qt 5.4 or later
- Android 5.x
- Gradle

## Installation

Build and install like any Qt module.

## Getting Started

Link to the library, and deploy the desired Android packages
in the application .pro file:

    QT += nativeandroid

A minimal QML example that can replace the main.qml when using
the Qt Quick Application template in Qt Creator. The rest can
stay the same, using QQmlApplicationEngine to load the main.qml:

    import android 0.21
    import android.app 0.21
    import android.view 0.21
    import android.widget 0.21

    Activity {
        contentView: Button {
            text: "Button"
        }
    }

Using an options menu in Activity requires changing the activity
type in AndroidManifest.xml. The default activity type for Qt apps
is "org.qtproject.qt5.android.bindings.QtActivity", which must be
changed to "org.qtproject.qt5.android.bindings.app.QtNativeActivity".
In order to create the file, click "Create Templates" in Qt Creator:

    Projects -> Build & Run -> Build Steps -> Build Android APK

## Notes

The Android 5.x dependency is not going to stay. Proper Android version
handling is just missing for the time being. The goal of the hackathon
project was to create a visually stunning demo, not a polished product. ;)