Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtquick-for-android.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\title Qt Quick for Android
6
\brief An overview on using QML in native Android projects.
7
\page qtquick-for-android.html
8
\ingroup android-platform-extra-topics
9
10
\section1 Qt Quick for Android overview
11
12
The basis of this approach is to offer Qt QML APIs in an embedded way so
13
that the app will remain a relatively typical Android app. This approach
14
offers a more standard Android-centered approach at the cost of leveraging
15
the cross-platform nature of a Qt application. It's best suited for adding
16
desirable Qt features to an existing Android application.
17
18
\list
19
\li Android creates the Qt content and controls it.
20
\li Android Studio with the \l{\QtTAS} plugin is used for development.
21
\li For Qt content, Qt Creator or Qt Design Studio are used.
22
\li Main languages are Java and Kotlin, with QML used for specific parts
23
such as 3D content.
24
\li You can use any Android APIs you want, but you can use JNI if you want more
25
control over communication between your Java code and QML. See \l{QJniObject}
26
and \l{QJniEnvironment}.
27
\endlist
28
29
\section2 How this differs from Qt for Android
30
31
The most prominent difference between these approaches is the project structure.
32
Qt for Android applications are CMake projects that can be built for Android or
33
other platforms, while a Qt Quick for Android Project is an Android project that
34
includes QML content and can only be built for Android.
35
36
\image qtquick-for-android-comparisson.drawio.svg
37
{Comparison of Qt for Android and Qt Quick for Android workflows}
38
39
The main objective of the Qt for Android approach is to let Qt handle most of the work
40
of the architecture and boilerplate code of the app and let you focus on the
41
content. It offers a complete and reliable cross-platform approach.
42
43
\list
44
\li Qt creates and controls the Android app.
45
\li \l{\QC Documentation}{\QC}, \l{Qt Design Studio}, or Visual Studio
46
can be used.
47
\li Main languages are C++ and QML.
48
\li Android specifics are more hidden; Qt handles these internally.
49
\li To use Android APIs not yet available as Qt APIs, you must use JNI.
50
See \l{QJniObject} and \l{QJniEnvironment}.
51
\endlist
52
53
See \l{How Qt for Android Works} for further details on Qt for Android's architecture.
54
55
\section1 How Qt Quick for Android works
56
57
Qt Quick for Android offers you \l{Qt Quick Android Classes}{Android APIs} that enable
58
you to insert QML content as an \l{Android: View}{Android View} in your project.
59
60
\image qtquick-for-android-architecture.drawio.svg
61
{Architecture diagram showing Qt Quick embedded in an Android app}
62
63
\section1 APIs
64
\target Android Classes
65
These are the public Java and Kotlin APIs that you will use in an Android
66
app to embed QML.
67
68
\section2 Java classes
69
70
\list
71
\li \l{QtQuickView}
72
\li \l{QtQuickViewContent}
73
\li \l{QtAbstractItemModel}
74
\li \l{QtAbstractListModel}
75
\li \l{QtModelIndex}
76
\endlist
77
78
\section2 Interfaces
79
80
\list
81
\li \l{QtQmlStatusChangeListener} (which uses the \l QtQmlStatus enum)
82
\endlist
83
84
\note See the \l{QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS} CMake
85
variable for further information on Java code generation of QML components.
86
87
\section1 API examples
88
89
\list
90
\li \l{Qt Quick for Android Studio Projects}
91
\li \l{Exposing QtAbstractListModel to QML}
92
\li \l{Using QtAbstractItemModel in Android Studio Projects}
93
\endlist
94
95
\include qtquick-for-android-main().qdocinc
96
97
\section2 Running Qt Quick for Android examples
98
99
\include running-qtquick-for-android-examples.qdocinc
100
101
\section1 Tooling
102
103
The \l{Qt Gradle Plugin} and \l{\QtTAS} plugin are provided by Qt for easy
104
development. You can use the Gradle Plugin independently from an IDE as part
105
of your build toolchain. \QtTAS uses the plugin to build your projects in
106
Android Studio.
107
108
\section1 Where to go from here
109
110
The following additional topics apply to Qt Quick For Android:
111
112
\annotatedlist qq4a-extra-topics
113
114
*/
qtdeclarative
src
quick
doc
src
android
qtquick-for-android.qdoc
Generated on
for Qt by
1.16.1