##// END OF EJS Templates
Fix qml application deployment for android...
Heikkinen Miikka -
r2523:abf0d5005e35
parent child
Show More
@@ -14,3 +14,23 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
14
14
15 # staticlib config causes problems when building executables
15 # staticlib config causes problems when building executables
16 staticlib: CONFIG-=staticlib
16 staticlib: CONFIG-=staticlib
17
18 android {
19 # Workaround to fix android deployment, which seems to always look for target in
20 # OUT_PWD instead of DESTDIR.
21 QMAKE_POST_LINK += $$QMAKE_COPY $$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so
22
23 contains(TARGET, qml.*) {
24 charts_qmldir.files = $$CHART_BUILD_QML_PLUGIN_DIR/qmldir
25 charts_qmldir.path = /assets/imports/QtCommercial/Chart
26 charts_qmlplugin.files = $$CHART_BUILD_QML_PLUGIN_DIR/libqtcommercialchartqml.so
27 charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
28 INSTALLS += charts_qmldir charts_qmlplugin
29 } else:contains(TARGET, quick2.*) {
30 charts_qmldir.files = $$CHART_BUILD_QML2_PLUGIN_DIR/qmldir
31 charts_qmldir.path = /assets/qml/QtCommercial/Chart
32 charts_qmlplugin.files = $$CHART_BUILD_QML2_PLUGIN_DIR/libqtcommercialchartqml2.so
33 charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
34 INSTALLS += charts_qmldir charts_qmlplugin
35 }
36 }
@@ -20,14 +20,19
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QtDeclarative/QDeclarativeEngine>
22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 #include "qmlapplicationviewer.h"
24 #include "qmlapplicationviewer.h"
24
25
25 Q_DECL_EXPORT int main(int argc, char *argv[])
26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 {
27 {
27 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30 #ifdef Q_OS_ANDROID
30
31 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
32 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
33 #else
34 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
35 #endif
31 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
36 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer->setSource(QUrl("qrc:/qml/qmlaxes/loader.qml"));
37 viewer->setSource(QUrl("qrc:/qml/qmlaxes/loader.qml"));
33 viewer->setRenderHint(QPainter::Antialiasing, true);
38 viewer->setRenderHint(QPainter::Antialiasing, true);
@@ -20,13 +20,19
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QtDeclarative/QDeclarativeEngine>
22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 #include "qmlapplicationviewer.h"
24 #include "qmlapplicationviewer.h"
24
25
25 Q_DECL_EXPORT int main(int argc, char *argv[])
26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 {
27 {
27 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30 #ifdef Q_OS_ANDROID
31 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
32 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
33 #else
34 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
35 #endif
30
36
31 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer->setSource(QUrl("qrc:/qml/qmlchart/loader.qml"));
38 viewer->setSource(QUrl("qrc:/qml/qmlchart/loader.qml"));
@@ -20,13 +20,19
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QtDeclarative/QDeclarativeEngine>
22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 #include "qmlapplicationviewer.h"
24 #include "qmlapplicationviewer.h"
24
25
25 Q_DECL_EXPORT int main(int argc, char *argv[])
26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 {
27 {
27 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30 #ifdef Q_OS_ANDROID
31 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
32 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
33 #else
34 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
35 #endif
30
36
31 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer->setSource(QUrl("qrc:/qml/qmlcustomizations/loader.qml"));
38 viewer->setSource(QUrl("qrc:/qml/qmlcustomizations/loader.qml"));
@@ -20,13 +20,19
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QtDeclarative/QDeclarativeEngine>
22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 #include "qmlapplicationviewer.h"
24 #include "qmlapplicationviewer.h"
24
25
25 Q_DECL_EXPORT int main(int argc, char *argv[])
26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 {
27 {
27 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30 #ifdef Q_OS_ANDROID
31 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
32 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
33 #else
34 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
35 #endif
30
36
31 //viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
37 //viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer->setSource(QUrl("qrc:/qml/qmlcustomlegend/loader.qml"));
38 viewer->setSource(QUrl("qrc:/qml/qmlcustomlegend/loader.qml"));
@@ -22,6 +22,7
22 #include <QtDeclarative>
22 #include <QtDeclarative>
23 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QtDeclarative/QDeclarativeEngine>
24 #include <QAbstractItemModel>
24 #include <QAbstractItemModel>
25 #include <QDir>
25 #include "declarativemodel.h"
26 #include "declarativemodel.h"
26 #include "customtablemodel.h"
27 #include "customtablemodel.h"
27 #include "qmlapplicationviewer.h"
28 #include "qmlapplicationviewer.h"
@@ -32,7 +33,12 Q_DECL_EXPORT int main(int argc, char *argv[])
32 {
33 {
33 QScopedPointer<QApplication> app(createApplication(argc, argv));
34 QScopedPointer<QApplication> app(createApplication(argc, argv));
34 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
35 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
35 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
36 #ifdef Q_OS_ANDROID
37 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
38 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
39 #else
40 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
41 #endif
36
42
37 // @uri QmlCustomModel
43 // @uri QmlCustomModel
38 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
44 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
@@ -19,8 +19,9
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include <QApplication>
21 #include <QApplication>
22 //#include <QDeclarativeContext>
22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDebug>
23 #include <QDebug>
24 #include <QDir>
24 #include "qmlapplicationviewer.h"
25 #include "qmlapplicationviewer.h"
25
26
26 Q_DECL_EXPORT int main(int argc, char *argv[])
27 Q_DECL_EXPORT int main(int argc, char *argv[])
@@ -28,7 +29,12 Q_DECL_EXPORT int main(int argc, char *argv[])
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
29 QScopedPointer<QApplication> app(createApplication(argc, argv));
29
30
30 QmlApplicationViewer viewer;
31 QmlApplicationViewer viewer;
31 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
32 #ifdef Q_OS_ANDROID
33 viewer.addImportPath(QString::fromLatin1("assets:/imports"));
34 viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
35 #else
36 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
37 #endif
32 // viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
38 // viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
33 viewer.setSource(QUrl("qrc:/qml/qmlf1legends/main.qml"));
39 viewer.setSource(QUrl("qrc:/qml/qmlf1legends/main.qml"));
34 viewer.setRenderHint(QPainter::Antialiasing, true);
40 viewer.setRenderHint(QPainter::Antialiasing, true);
@@ -20,6 +20,8
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QtDeclarative/QDeclarativeContext>
22 #include <QtDeclarative/QDeclarativeContext>
23 #include <QtDeclarative/QDeclarativeEngine>
24 #include <QDir>
23 #include "qmlapplicationviewer.h"
25 #include "qmlapplicationviewer.h"
24 #include "datasource.h"
26 #include "datasource.h"
25
27
@@ -27,7 +29,12 Q_DECL_EXPORT int main(int argc, char *argv[])
27 {
29 {
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
30 QScopedPointer<QApplication> app(createApplication(argc, argv));
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
31 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
30 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
32 #ifdef Q_OS_ANDROID
33 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
34 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
35 #else
36 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
37 #endif
31
38
32 DataSource dataSource(viewer.data());
39 DataSource dataSource(viewer.data());
33 viewer->rootContext()->setContextProperty("dataSource", &dataSource);
40 viewer->rootContext()->setContextProperty("dataSource", &dataSource);
@@ -20,13 +20,19
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QtDeclarative/QDeclarativeEngine>
22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 #include "qmlapplicationviewer.h"
24 #include "qmlapplicationviewer.h"
24
25
25 Q_DECL_EXPORT int main(int argc, char *argv[])
26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 {
27 {
27 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30 #ifdef Q_OS_ANDROID
31 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
32 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
33 #else
34 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
35 #endif
30
36
31 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer->setSource(QUrl("qrc:/qml/qmlpolarchart/loader.qml"));
38 viewer->setSource(QUrl("qrc:/qml/qmlpolarchart/loader.qml"));
@@ -20,7 +20,9
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QtDeclarative/QDeclarativeContext>
22 #include <QtDeclarative/QDeclarativeContext>
23 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDebug>
24 #include <QDebug>
25 #include <QDir>
24 #include "qmlapplicationviewer.h"
26 #include "qmlapplicationviewer.h"
25
27
26 Q_DECL_EXPORT int main(int argc, char *argv[])
28 Q_DECL_EXPORT int main(int argc, char *argv[])
@@ -28,7 +30,12 Q_DECL_EXPORT int main(int argc, char *argv[])
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
30 QScopedPointer<QApplication> app(createApplication(argc, argv));
29
31
30 QmlApplicationViewer viewer;
32 QmlApplicationViewer viewer;
31 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
33 #ifdef Q_OS_ANDROID
34 viewer.addImportPath(QString::fromLatin1("assets:/imports"));
35 viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
36 #else
37 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
38 #endif
32 // viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
39 // viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
33 QString appKey;
40 QString appKey;
34 if (argc > 1) {
41 if (argc > 1) {
@@ -20,6 +20,8
20
20
21 #include <QtWidgets/QApplication>
21 #include <QtWidgets/QApplication>
22 #include <QtQuick/QQuickItem>
22 #include <QtQuick/QQuickItem>
23 #include <QDir>
24 #include <QtQml/QQmlEngine>
23 #include "qtquick2applicationviewer.h"
25 #include "qtquick2applicationviewer.h"
24
26
25 int main(int argc, char *argv[])
27 int main(int argc, char *argv[])
@@ -27,7 +29,12 int main(int argc, char *argv[])
27 QApplication app(argc, argv);
29 QApplication app(argc, argv);
28
30
29 QtQuick2ApplicationViewer viewer;
31 QtQuick2ApplicationViewer viewer;
32 #ifdef Q_OS_ANDROID
33 viewer.addImportPath(QString::fromLatin1("assets:/qml"));
34 viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
35 #else
30 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
36 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
37 #endif
31 viewer.setSource(QUrl("qrc:/qml/quick2chart/main.qml"));
38 viewer.setSource(QUrl("qrc:/qml/quick2chart/main.qml"));
32 viewer.showExpanded();
39 viewer.showExpanded();
33
40
@@ -21,6 +21,8
21 #include <QtWidgets/QApplication>
21 #include <QtWidgets/QApplication>
22 #include <QtQuick/QQuickItem>
22 #include <QtQuick/QQuickItem>
23 #include <QtQml/QQmlContext>
23 #include <QtQml/QQmlContext>
24 #include <QtQml/QQmlEngine>
25 #include <QDir>
24 #include "qtquick2applicationviewer.h"
26 #include "qtquick2applicationviewer.h"
25 #include "datasource.h"
27 #include "datasource.h"
26
28
@@ -29,7 +31,12 int main(int argc, char *argv[])
29 QApplication app(argc, argv);
31 QApplication app(argc, argv);
30
32
31 QtQuick2ApplicationViewer viewer;
33 QtQuick2ApplicationViewer viewer;
34 #ifdef Q_OS_ANDROID
35 viewer.addImportPath(QString::fromLatin1("assets:/qml"));
36 viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
37 #else
32 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
38 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
39 #endif
33
40
34 DataSource dataSource(&viewer);
41 DataSource dataSource(&viewer);
35 viewer.rootContext()->setContextProperty("dataSource", &dataSource);
42 viewer.rootContext()->setContextProperty("dataSource", &dataSource);
@@ -14,3 +14,17 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
14
14
15 # staticlib config causes problems when building executables
15 # staticlib config causes problems when building executables
16 staticlib: CONFIG-=staticlib
16 staticlib: CONFIG-=staticlib
17
18 android {
19 # Workaround to fix android deployment, which seems to always look for target in
20 # OUT_PWD instead of DESTDIR.
21 QMAKE_POST_LINK += $$QMAKE_COPY $$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so
22
23 contains(TARGET, qml.*) {
24 charts_qmldir.files = $$CHART_BUILD_QML_PLUGIN_DIR/qmldir
25 charts_qmldir.path = /assets/imports/QtCommercial/Chart
26 charts_qmlplugin.files = $$CHART_BUILD_QML_PLUGIN_DIR/libqtcommercialchartqml.so
27 charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
28 INSTALLS += charts_qmldir charts_qmlplugin
29 }
30 }
@@ -20,13 +20,19
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QtDeclarative/QDeclarativeEngine>
22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 #include "qmlapplicationviewer.h"
24 #include "qmlapplicationviewer.h"
24
25
25 Q_DECL_EXPORT int main(int argc, char *argv[])
26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 {
27 {
27 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30 #ifdef Q_OS_ANDROID
31 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
32 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
33 #else
34 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
35 #endif
30
36
31 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer->setSource(QUrl("qrc:/qml/qmlpiechart/main.qml"));
38 viewer->setSource(QUrl("qrc:/qml/qmlpiechart/main.qml"));
@@ -20,6 +20,7
20 #include <QtTest/QtTest>
20 #include <QtTest/QtTest>
21 #include <QDeclarativeEngine>
21 #include <QDeclarativeEngine>
22 #include <QDeclarativeComponent>
22 #include <QDeclarativeComponent>
23 #include <QDir>
23 #include "tst_definitions.h"
24 #include "tst_definitions.h"
24
25
25 class tst_QML : public QObject
26 class tst_QML : public QObject
@@ -126,7 +127,12 void tst_QML::checkPlugin()
126 {
127 {
127 QFETCH(QString, source);
128 QFETCH(QString, source);
128 QDeclarativeEngine engine;
129 QDeclarativeEngine engine;
129 engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
130 #ifdef Q_OS_ANDROID
131 engine.addImportPath(QString::fromLatin1("assets:/imports"));
132 engine.addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
133 #else
134 engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
135 #endif
130 QDeclarativeComponent component(&engine);
136 QDeclarativeComponent component(&engine);
131 component.setData(source.toLatin1(), QUrl());
137 component.setData(source.toLatin1(), QUrl());
132 QVERIFY2(!component.isError(), qPrintable(componentErrors(&component)));
138 QVERIFY2(!component.isError(), qPrintable(componentErrors(&component)));
@@ -20,13 +20,19
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QDeclarativeEngine>
22 #include <QDeclarativeEngine>
23 #include <QDir>
23 #include "qmlapplicationviewer.h"
24 #include "qmlapplicationviewer.h"
24
25
25 Q_DECL_EXPORT int main(int argc, char *argv[])
26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 {
27 {
27 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30 #ifdef Q_OS_ANDROID
31 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
32 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
33 #else
34 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
35 #endif
30
36
31 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer->setSource(QUrl("qrc:/qml/qmlchartaxis/main.qml"));
38 viewer->setSource(QUrl("qrc:/qml/qmlchartaxis/main.qml"));
@@ -20,13 +20,19
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QDeclarativeEngine>
22 #include <QDeclarativeEngine>
23 #include <QDir>
23 #include "qmlapplicationviewer.h"
24 #include "qmlapplicationviewer.h"
24
25
25 Q_DECL_EXPORT int main(int argc, char *argv[])
26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 {
27 {
27 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30 #ifdef Q_OS_ANDROID
31 viewer->addImportPath(QString::fromLatin1("assets:/imports"));
32 viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
33 #else
34 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
35 #endif
30
36
31 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer->setSource(QUrl("qrc:/qml/qmlchartproperties/loader.qml"));
38 viewer->setSource(QUrl("qrc:/qml/qmlchartproperties/loader.qml"));
@@ -20,6 +20,8
20
20
21 #include <QtWidgets/QApplication>
21 #include <QtWidgets/QApplication>
22 #include <QtQuick/QQuickItem>
22 #include <QtQuick/QQuickItem>
23 #include <QDir>
24 #include <QtQml/QQmlEngine>
23 #include "qtquick2applicationviewer.h"
25 #include "qtquick2applicationviewer.h"
24
26
25 int main(int argc, char *argv[])
27 int main(int argc, char *argv[])
@@ -27,7 +29,12 int main(int argc, char *argv[])
27 QApplication app(argc, argv);
29 QApplication app(argc, argv);
28
30
29 QtQuick2ApplicationViewer viewer;
31 QtQuick2ApplicationViewer viewer;
32 #ifdef Q_OS_ANDROID
33 viewer.addImportPath(QString::fromLatin1("assets:/qml"));
34 viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
35 #else
30 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
36 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
37 #endif
31 viewer.setSource(QUrl("qrc:/qml/quick2chartproperties/main.qml"));
38 viewer.setSource(QUrl("qrc:/qml/quick2chartproperties/main.qml"));
32 viewer.showExpanded();
39 viewer.showExpanded();
33
40
@@ -12,3 +12,23 RCC_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
12
12
13 # staticlib config causes problems when building executables
13 # staticlib config causes problems when building executables
14 staticlib: CONFIG-=staticlib
14 staticlib: CONFIG-=staticlib
15
16 android {
17 # Workaround to fix android deployment, which seems to always look for target in
18 # OUT_PWD instead of DESTDIR.
19 QMAKE_POST_LINK += $$QMAKE_COPY $$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so
20
21 contains(TARGET, qml.*) {
22 charts_qmldir.files = $$CHART_BUILD_QML_PLUGIN_DIR/qmldir
23 charts_qmldir.path = /assets/imports/QtCommercial/Chart
24 charts_qmlplugin.files = $$CHART_BUILD_QML_PLUGIN_DIR/libqtcommercialchartqml.so
25 charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
26 INSTALLS += charts_qmldir charts_qmlplugin
27 } else:contains(TARGET, quick2.*) {
28 charts_qmldir.files = $$CHART_BUILD_QML2_PLUGIN_DIR/qmldir
29 charts_qmldir.path = /assets/qml/QtCommercial/Chart
30 charts_qmlplugin.files = $$CHART_BUILD_QML2_PLUGIN_DIR/libqtcommercialchartqml2.so
31 charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
32 INSTALLS += charts_qmldir charts_qmlplugin
33 }
34 }
General Comments 0
You need to be logged in to leave comments. Login now