##// END OF EJS Templates
Fix qml application deployment for android...
Heikkinen Miikka -
r2523:abf0d5005e35
parent child
Show More
@@ -1,16 +1,36
1 1 !include( ../config.pri ) {
2 2 error( "Couldn't find the config.pri file!" )
3 3 }
4 4
5 5 DESTDIR = $$CHART_BUILD_BIN_DIR
6 6 OBJECTS_DIR = $$CHART_BUILD_DIR/demos/$$TARGET
7 7 MOC_DIR = $$CHART_BUILD_DIR/demos/$$TARGET
8 8 UI_DIR = $$CHART_BUILD_DIR/demos/$$TARGET
9 9 RCC_DIR = $$CHART_BUILD_DIR/demos/$$TARGET
10 10
11 11 TEMPLATE = app
12 12 QT += core gui
13 13 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
14 14
15 15 # staticlib config causes problems when building executables
16 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 }
@@ -1,37 +1,42
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 24 #include "qmlapplicationviewer.h"
24 25
25 26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 27 {
27 28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 29 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
29 viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
30
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
31 36 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 37 viewer->setSource(QUrl("qrc:/qml/qmlaxes/loader.qml"));
33 38 viewer->setRenderHint(QPainter::Antialiasing, true);
34 39 viewer->showExpanded();
35 40
36 41 return app->exec();
37 42 }
@@ -1,37 +1,43
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 24 #include "qmlapplicationviewer.h"
24 25
25 26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 27 {
27 28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 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 37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 38 viewer->setSource(QUrl("qrc:/qml/qmlchart/loader.qml"));
33 39 viewer->setRenderHint(QPainter::Antialiasing, true);
34 40 viewer->showExpanded();
35 41
36 42 return app->exec();
37 43 }
@@ -1,37 +1,43
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 24 #include "qmlapplicationviewer.h"
24 25
25 26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 27 {
27 28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 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 37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 38 viewer->setSource(QUrl("qrc:/qml/qmlcustomizations/loader.qml"));
33 39 viewer->setRenderHint(QPainter::Antialiasing, true);
34 40 viewer->showExpanded();
35 41
36 42 return app->exec();
37 43 }
@@ -1,37 +1,43
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 24 #include "qmlapplicationviewer.h"
24 25
25 26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 27 {
27 28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 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 37 //viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 38 viewer->setSource(QUrl("qrc:/qml/qmlcustomlegend/loader.qml"));
33 39 viewer->setRenderHint(QPainter::Antialiasing, true);
34 40 viewer->showExpanded();
35 41
36 42 return app->exec();
37 43 }
@@ -1,49 +1,55
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative>
23 23 #include <QtDeclarative/QDeclarativeEngine>
24 24 #include <QAbstractItemModel>
25 #include <QDir>
25 26 #include "declarativemodel.h"
26 27 #include "customtablemodel.h"
27 28 #include "qmlapplicationviewer.h"
28 29
29 30 const char *uri = "QmlCustomModel";
30 31
31 32 Q_DECL_EXPORT int main(int argc, char *argv[])
32 33 {
33 34 QScopedPointer<QApplication> app(createApplication(argc, argv));
34 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 43 // @uri QmlCustomModel
38 44 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
39 45 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
40 46 qmlRegisterType<DeclarativeTableModel>(uri, 1, 0, "CustomModel");
41 47 qmlRegisterType<DeclarativeTableModelElement>(uri, 1, 0, "CustomModelElement");
42 48
43 49 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
44 50 viewer->setSource(QUrl("qrc:/qml/qmlcustommodel/loader.qml"));
45 51 viewer->setRenderHint(QPainter::Antialiasing, true);
46 52 viewer->showExpanded();
47 53
48 54 return app->exec();
49 55 }
@@ -1,37 +1,43
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 //#include <QDeclarativeContext>
22 #include <QtDeclarative/QDeclarativeEngine>
23 23 #include <QDebug>
24 #include <QDir>
24 25 #include "qmlapplicationviewer.h"
25 26
26 27 Q_DECL_EXPORT int main(int argc, char *argv[])
27 28 {
28 29 QScopedPointer<QApplication> app(createApplication(argc, argv));
29 30
30 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 38 // viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
33 39 viewer.setSource(QUrl("qrc:/qml/qmlf1legends/main.qml"));
34 40 viewer.setRenderHint(QPainter::Antialiasing, true);
35 41 viewer.showExpanded();
36 42 return app->exec();
37 43 }
@@ -1,40 +1,47
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative/QDeclarativeContext>
23 #include <QtDeclarative/QDeclarativeEngine>
24 #include <QDir>
23 25 #include "qmlapplicationviewer.h"
24 26 #include "datasource.h"
25 27
26 28 Q_DECL_EXPORT int main(int argc, char *argv[])
27 29 {
28 30 QScopedPointer<QApplication> app(createApplication(argc, argv));
29 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 39 DataSource dataSource(viewer.data());
33 40 viewer->rootContext()->setContextProperty("dataSource", &dataSource);
34 41
35 42 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
36 43 viewer->setSource(QUrl("qrc:/qml/qmloscilloscope/main.qml"));
37 44 viewer->showExpanded();
38 45
39 46 return app->exec();
40 47 }
@@ -1,37 +1,43
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 24 #include "qmlapplicationviewer.h"
24 25
25 26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 27 {
27 28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 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 37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 38 viewer->setSource(QUrl("qrc:/qml/qmlpolarchart/loader.qml"));
33 39 viewer->setRenderHint(QPainter::Antialiasing, true);
34 40 viewer->showExpanded();
35 41
36 42 return app->exec();
37 43 }
@@ -1,45 +1,52
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative/QDeclarativeContext>
23 #include <QtDeclarative/QDeclarativeEngine>
23 24 #include <QDebug>
25 #include <QDir>
24 26 #include "qmlapplicationviewer.h"
25 27
26 28 Q_DECL_EXPORT int main(int argc, char *argv[])
27 29 {
28 30 QScopedPointer<QApplication> app(createApplication(argc, argv));
29 31
30 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 39 // viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
33 40 QString appKey;
34 41 if (argc > 1) {
35 42 appKey = argv[1];
36 43 qDebug() << "App key for worldweatheronline.com:" << appKey;
37 44 } else {
38 45 qWarning() << "No app key for worldweatheronline.com given. Using static test data instead of live data.";
39 46 }
40 47 viewer.rootContext()->setContextProperty("weatherAppKey", appKey);
41 48 viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml"));
42 49 viewer.setRenderHint(QPainter::Antialiasing, true);
43 50 viewer.showExpanded();
44 51 return app->exec();
45 52 }
@@ -1,35 +1,42
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QtWidgets/QApplication>
22 22 #include <QtQuick/QQuickItem>
23 #include <QDir>
24 #include <QtQml/QQmlEngine>
23 25 #include "qtquick2applicationviewer.h"
24 26
25 27 int main(int argc, char *argv[])
26 28 {
27 29 QApplication app(argc, argv);
28 30
29 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 36 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
37 #endif
31 38 viewer.setSource(QUrl("qrc:/qml/quick2chart/main.qml"));
32 39 viewer.showExpanded();
33 40
34 41 return app.exec();
35 42 }
@@ -1,41 +1,48
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QtWidgets/QApplication>
22 22 #include <QtQuick/QQuickItem>
23 23 #include <QtQml/QQmlContext>
24 #include <QtQml/QQmlEngine>
25 #include <QDir>
24 26 #include "qtquick2applicationviewer.h"
25 27 #include "datasource.h"
26 28
27 29 int main(int argc, char *argv[])
28 30 {
29 31 QApplication app(argc, argv);
30 32
31 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 38 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
39 #endif
33 40
34 41 DataSource dataSource(&viewer);
35 42 viewer.rootContext()->setContextProperty("dataSource", &dataSource);
36 43
37 44 viewer.setSource(QUrl("qrc:/qml/quick2oscilloscope/main.qml"));
38 45 viewer.showExpanded();
39 46
40 47 return app.exec();
41 48 }
@@ -1,16 +1,30
1 1 !include( ../config.pri ) {
2 2 error( "Couldn't find the config.pri file!" )
3 3 }
4 4
5 5 DESTDIR = $$CHART_BUILD_BIN_DIR
6 6 OBJECTS_DIR = $$CHART_BUILD_DIR/examples/$$TARGET
7 7 MOC_DIR = $$CHART_BUILD_DIR/examples/$$TARGET
8 8 UI_DIR = $$CHART_BUILD_DIR/examples/$$TARGET
9 9 RCC_DIR = $$CHART_BUILD_DIR/examples/$$TARGET
10 10
11 11 TEMPLATE = app
12 12 QT += core gui
13 13 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
14 14
15 15 # staticlib config causes problems when building executables
16 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 }
@@ -1,37 +1,43
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QtDeclarative/QDeclarativeEngine>
23 #include <QDir>
23 24 #include "qmlapplicationviewer.h"
24 25
25 26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 27 {
27 28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 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 37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 38 viewer->setSource(QUrl("qrc:/qml/qmlpiechart/main.qml"));
33 39 viewer->setRenderHint(QPainter::Antialiasing, true);
34 40 viewer->showExpanded();
35 41
36 42 return app->exec();
37 43 }
@@ -1,147 +1,153
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20 #include <QtTest/QtTest>
21 21 #include <QDeclarativeEngine>
22 22 #include <QDeclarativeComponent>
23 #include <QDir>
23 24 #include "tst_definitions.h"
24 25
25 26 class tst_QML : public QObject
26 27 {
27 28 Q_OBJECT
28 29
29 30 public slots:
30 31 void initTestCase();
31 32 void cleanupTestCase();
32 33 void init();
33 34 void cleanup();
34 35 private slots:
35 36 void checkPlugin_data();
36 37 void checkPlugin();
37 38 private:
38 39 QString componentErrors(const QDeclarativeComponent* component) const;
39 40 QString imports_1_1();
40 41 QString imports_1_3();
41 42
42 43 };
43 44
44 45 QString tst_QML::componentErrors(const QDeclarativeComponent* component) const
45 46 {
46 47 Q_ASSERT(component);
47 48
48 49 QStringList errors;
49 50
50 51 foreach (QDeclarativeError const& error, component->errors()) {
51 52 errors << error.toString();
52 53 }
53 54
54 55 return errors.join("\n");
55 56 }
56 57
57 58 QString tst_QML::imports_1_1()
58 59 {
59 60 return "import QtQuick 1.0 \n"
60 61 "import QtCommercial.Chart 1.1 \n";
61 62 }
62 63
63 64 QString tst_QML::imports_1_3()
64 65 {
65 66 return "import QtQuick 1.0 \n"
66 67 "import QtCommercial.Chart 1.3 \n";
67 68 }
68 69
69 70
70 71 void tst_QML::initTestCase()
71 72 {
72 73 }
73 74
74 75 void tst_QML::cleanupTestCase()
75 76 {
76 77 }
77 78
78 79 void tst_QML::init()
79 80 {
80 81
81 82 }
82 83
83 84 void tst_QML::cleanup()
84 85 {
85 86
86 87 }
87 88
88 89 void tst_QML::checkPlugin_data()
89 90 {
90 91 QTest::addColumn<QString>("source");
91 92
92 93 QTest::newRow("createChartView") << imports_1_1() + "ChartView{}";
93 94 QTest::newRow("XYPoint") << imports_1_1() + "XYPoint{}";
94 95 QTest::newRow("scatterSeries") << imports_1_1() + "ScatterSeries{}";
95 96 QTest::newRow("lineSeries") << imports_1_1() + "LineSeries{}";
96 97 QTest::newRow("splineSeries") << imports_1_1() + "SplineSeries{}";
97 98 QTest::newRow("areaSeries") << imports_1_1() + "AreaSeries{}";
98 99 QTest::newRow("barSeries") << imports_1_1() + "BarSeries{}";
99 100 QTest::newRow("stackedBarSeries") << imports_1_1() + "StackedBarSeries{}";
100 101 QTest::newRow("precentBarSeries") << imports_1_1() + "PercentBarSeries{}";
101 102 QTest::newRow("horizonatlBarSeries") << imports_1_1() + "HorizontalBarSeries{}";
102 103 QTest::newRow("horizonatlStackedBarSeries") << imports_1_1() + "HorizontalStackedBarSeries{}";
103 104 QTest::newRow("horizonatlstackedBarSeries") << imports_1_1() + "HorizontalPercentBarSeries{}";
104 105 QTest::newRow("pieSeries") << imports_1_1() + "PieSeries{}";
105 106 QTest::newRow("PieSlice") << imports_1_1() + "PieSlice{}";
106 107 QTest::newRow("BarSet") << imports_1_1() + "BarSet{}";
107 108 QTest::newRow("HXYModelMapper") << imports_1_1() + "HXYModelMapper{}";
108 109 QTest::newRow("VXYModelMapper") << imports_1_1() + "VXYModelMapper{}";
109 110 QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}";
110 111 QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}";
111 112 QTest::newRow("HBarModelMapper") << imports_1_1() + "HBarModelMapper{}";
112 113 QTest::newRow("VBarModelMapper") << imports_1_1() + "VBarModelMapper{}";
113 114 QTest::newRow("ValueAxis") << imports_1_1() + "ValueAxis{}";
114 115 #ifndef QT_ON_ARM
115 116 QTest::newRow("DateTimeAxis") << imports_1_1() + "DateTimeAxis{}";
116 117 #endif
117 118 QTest::newRow("CategoryAxis") << imports_1_1() + "CategoryAxis{}";
118 119 QTest::newRow("CategoryRange") << imports_1_1() + "CategoryRange{}";
119 120 QTest::newRow("BarCategoryAxis") << imports_1_1() + "BarCategoryAxis{}";
120 121
121 122 QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}";
122 123 QTest::newRow("LogValueAxis") << imports_1_3() + "LogValueAxis{}";
123 124 }
124 125
125 126 void tst_QML::checkPlugin()
126 127 {
127 128 QFETCH(QString, source);
128 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 136 QDeclarativeComponent component(&engine);
131 137 component.setData(source.toLatin1(), QUrl());
132 138 QVERIFY2(!component.isError(), qPrintable(componentErrors(&component)));
133 139 TRY_COMPARE(component.status(), QDeclarativeComponent::Ready);
134 140 QObject *obj = component.create();
135 141 QVERIFY(obj != 0);
136 142
137 143 //
138 144 //TODO:
139 145 // QCOMPARE(obj->property("something").toInt(), 0);
140 146
141 147 delete obj;
142 148 }
143 149
144 150 QTEST_MAIN(tst_QML)
145 151
146 152 #include "tst_qml.moc"
147 153
@@ -1,36 +1,42
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QDeclarativeEngine>
23 #include <QDir>
23 24 #include "qmlapplicationviewer.h"
24 25
25 26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 27 {
27 28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 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 37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 38 viewer->setSource(QUrl("qrc:/qml/qmlchartaxis/main.qml"));
33 39 viewer->showExpanded();
34 40
35 41 return app->exec();
36 42 }
@@ -1,37 +1,43
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QApplication>
22 22 #include <QDeclarativeEngine>
23 #include <QDir>
23 24 #include "qmlapplicationviewer.h"
24 25
25 26 Q_DECL_EXPORT int main(int argc, char *argv[])
26 27 {
27 28 QScopedPointer<QApplication> app(createApplication(argc, argv));
28 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 37 // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 38 viewer->setSource(QUrl("qrc:/qml/qmlchartproperties/loader.qml"));
33 39 viewer->setRenderHint(QPainter::Antialiasing, true);
34 40 viewer->showExpanded();
35 41
36 42 return app->exec();
37 43 }
@@ -1,35 +1,42
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include <QtWidgets/QApplication>
22 22 #include <QtQuick/QQuickItem>
23 #include <QDir>
24 #include <QtQml/QQmlEngine>
23 25 #include "qtquick2applicationviewer.h"
24 26
25 27 int main(int argc, char *argv[])
26 28 {
27 29 QApplication app(argc, argv);
28 30
29 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 36 viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
37 #endif
31 38 viewer.setSource(QUrl("qrc:/qml/quick2chartproperties/main.qml"));
32 39 viewer.showExpanded();
33 40
34 41 return app.exec();
35 42 }
@@ -1,14 +1,34
1 1 !include( ../config.pri ) {
2 2 error( "Couldn't find the config.pri file!" )
3 3 }
4 4
5 5 TEMPLATE = app
6 6
7 7 DESTDIR = $$CHART_BUILD_BIN_DIR
8 8 OBJECTS_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
9 9 MOC_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
10 10 UI_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
11 11 RCC_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
12 12
13 13 # staticlib config causes problems when building executables
14 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