Introduction¶
Qt Quick components for Android is a port of the Qt Quick components for Symbian to Android.
So far, no Android specifics has been added.
Downloads¶
Binaries for both armv5 and armv7 are available in the Files section.
Usage (for Necessitas alpha 3 update 2)¶
Assume a test project named "TestQMLAndroid".
When creating the new project in Qt Creator, a "qml/TestQMLAndroid/" dir is created, containing "main.qml".
Put the components into the project tree¶
Unzip the Qt component zip file corresponding to the CPU architecture of your project to the "qml" directory.
You will thus have a tree like this:
- qml - imports - plugins - TestQMLAndroid
Adjust "TestQMLAndroid.pro"¶
# Add more folders to ship with the application, here
folder_01.source = qml/TestQMLAndroid
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01
android {
qmlcomponents.source = qml/imports
qmlcomponents.target =
DEPLOYMENTFOLDERS += qmlcomponents
qmlplugins.files = \
qml/plugins/libandroidplugin_1_1.so \
qml/plugins/libqtcomponentsplugin_1_1.so
x86 {
qmlplugins.path = /libs/x86
} else: armeabi-v7a {
qmlplugins.path = /libs/armeabi-v7a
} else {
qmlplugins.path = /libs/armeabi
}
INSTALLS += qmlplugins
}
[...]
Apply the following patch to "qmlapplicationviewer/qmlapplicationviewer.pri"¶
--- a/qmlapplicationviewer/qmlapplicationviewer.pri
+++ b/qmlapplicationviewer/qmlapplicationviewer.pri
@@ -111,6 +111,7 @@ symbian {
QMAKE_EXTRA_TARGETS += first copydeploymentfolders
}
}
+}
android {
installPrefix = /assets
} else {
@@ -121,7 +122,12 @@ symbian {
itemfiles = $${item}.files
$$itemfiles = $$eval($${deploymentfolder}.source)
itempath = $${item}.path
- $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
+ win32 {
+ sourcePathSegments = $$split($${deploymentfolder}.source, /)
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
+ } else {
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
+ }
export($$itemfiles)
export($$itempath)
INSTALLS += $$item
@@ -148,7 +154,6 @@ symbian {
}
export(target.path)
INSTALLS += target
-}
export (ICON)
export (INSTALLS)
Adjust "main.cpp"¶
[...]
viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
#ifdef Q_OS_ANDROID
viewer->addImportPath("/imports/");
viewer->engine()->addPluginPath(QDir::homePath()+"/../lib");
#endif
viewer->setMainQmlFile(QLatin1String("qml/TestQMLAndroid/main.qml"));
viewer->engine()->setBaseUrl(QUrl::fromLocalFile("/"));
[...]
As a result, the plugins .so are deployed in the "lib" folder on Android, together with "libTestQMLAndroid.so", which is the application library.