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