From 396a01b4748decf4080add69471ee846a3d2dc46 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 12 Feb 2014 12:27:31 +0200 Subject: Take qml_plugin.prf into use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enables us to lose a bunch of hacks. Change-Id: Id7641012004428aa9782cfb5dbaf9fc9c4629706 Reviewed-by: Tomi Korpipää --- examples/examples.pri | 104 --------------------- examples/qmlbars/main.cpp | 21 +++-- examples/qmlcustominput/main.cpp | 21 +++-- examples/qmllegend/main.cpp | 21 +++-- examples/qmlmultigraph/main.cpp | 21 +++-- examples/qmloscilloscope/main.cpp | 19 ++-- examples/qmlscatter/main.cpp | 21 +++-- examples/qmlsurface/main.cpp | 21 +++-- examples/qmlsurfacelayers/main.cpp | 21 +++-- .../qmlsurfacelayers/qml/qmlsurfacelayers/main.qml | 8 +- 10 files changed, 91 insertions(+), 187 deletions(-) (limited to 'examples') diff --git a/examples/examples.pri b/examples/examples.pri index 046d6cd1..c4de656d 100644 --- a/examples/examples.pri +++ b/examples/examples.pri @@ -1,16 +1,3 @@ -android { - target.path = /libs/$$ANDROID_TARGET_ARCH -} else { - target.path = $$[QT_INSTALL_EXAMPLES]/datavisualization/$$TARGET -} - -win32 { - CONFIG(debug, release|debug):DESTDIR = $$OUT_PWD/debug - CONFIG(release, release|debug):DESTDIR = $$OUT_PWD/release -} else { - DESTDIR = $$OUT_PWD -} - INCLUDEPATH += ../../include LIBS += -L$$OUT_PWD/../../lib @@ -18,94 +5,3 @@ LIBS += -L$$OUT_PWD/../../lib TEMPLATE = app QT += datavisualization - -!static:android { - # Add Qt library to be loaded in shared android build - vis_lib_name = DataVisualization - vis_src_lib = lib$${vis_lib_name}.so - vis_lib_dir = $$OUT_PWD/../../lib/$$vis_src_lib - ANDROID_EXTRA_LIBS = $$vis_lib_dir -} - -contains(TARGET, qml.*) { - uri = QtDataVisualization - lib_name = datavisualizationqml2 - - uri_replaced = $$replace(uri, \\., $$QMAKE_DIR_SEP) - make_qmldir_path = $$DESTDIR/$$uri_replaced - !exists($$make_qmldir_path) { - make_qmldir_target = \"$$replace(make_qmldir_path, /, $$QMAKE_DIR_SEP)\" - system($$QMAKE_MKDIR $$make_qmldir_target) - } - copy_qmldir.target = $$make_qmldir_path/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/../../src/$$lib_name/qmldir - copy_qmldir_formatted = \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - copy_qmldir.commands = $(COPY_FILE) $$copy_qmldir_formatted - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target - - static:contains(QT_CONFIG, static) { - # Make import scan find our copied qmldir & statically built qml lib - !win32 { - LIB_EXTENSION = a - } else { - LIB_EXTENSION = lib - } - QMLPATHS += $$DESTDIR - # We need to copy the qmldir & lib already at qmake run stage as import scan is done then - exists($$copy_qmldir.depends): system($$QMAKE_COPY $$copy_qmldir_formatted) - } else { - win32 { - LIB_EXTENSION = dll - } else { - mac|ios { - LIB_EXTENSION = dylib - } else { - LIB_EXTENSION = so - } - } - } - - win32 { - CONFIG(debug, release|debug) { - src_dir = /debug - src_lib = $${lib_name}d.$$LIB_EXTENSION - } - CONFIG(release, release|debug){ - src_dir = /release - src_lib = $${lib_name}.$$LIB_EXTENSION - } - } else { - src_dir = - mac|ios { - CONFIG(debug, release|debug) { - src_lib = lib$${lib_name}_debug.$$LIB_EXTENSION - } - CONFIG(release, release|debug){ - src_lib = lib$${lib_name}.$$LIB_EXTENSION - } - } else { - # linux, android - src_lib = lib$${lib_name}.$$LIB_EXTENSION - } - } - copy_lib.target = $$make_qmldir_path/$$src_lib - copy_lib.depends = $$OUT_PWD/../../src/$$lib_name$$src_dir/$$src_lib - copy_lib_formatted = \"$$replace(copy_lib.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_lib.target, /, $$QMAKE_DIR_SEP)\" - copy_lib.commands = $(COPY_FILE) $$copy_lib_formatted - QMAKE_EXTRA_TARGETS += copy_lib - PRE_TARGETDEPS += $$copy_lib.target - - android { - system($$QMAKE_COPY $$copy_qmldir_formatted) - android_qmldir.files = $$copy_qmldir.target - android_qmldir.path = /assets/qml/$$uri_replaced - INSTALLS += android_qmldir - } - android|ios { - system($$QMAKE_COPY $$copy_lib_formatted) - android_qmlplugin.files = $$copy_lib.target - android_qmlplugin.path = $$target.path - INSTALLS += android_qmlplugin - } -} diff --git a/examples/qmlbars/main.cpp b/examples/qmlbars/main.cpp index 54e44634..d3cfaf0c 100644 --- a/examples/qmlbars/main.cpp +++ b/examples/qmlbars/main.cpp @@ -16,14 +16,11 @@ ** ****************************************************************************/ +#include "qtquick2applicationviewer.h" #include + #include -#include "qtquick2applicationviewer.h" -#ifdef Q_OS_ANDROID -#include -#include -#endif -#include +#include int main(int argc, char *argv[]) { @@ -34,10 +31,14 @@ int main(int argc, char *argv[]) // Enable antialiasing viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + viewer.addImportPath(QString::fromLatin1("%1/../../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); #endif viewer.setTitle(QStringLiteral("Monthly income/expenses")); diff --git a/examples/qmlcustominput/main.cpp b/examples/qmlcustominput/main.cpp index 02dd8954..cc602be7 100644 --- a/examples/qmlcustominput/main.cpp +++ b/examples/qmlcustominput/main.cpp @@ -16,14 +16,11 @@ ** ****************************************************************************/ +#include "qtquick2applicationviewer.h" #include + #include -#include "qtquick2applicationviewer.h" -#ifdef Q_OS_ANDROID -#include -#include -#endif -#include +#include int main(int argc, char *argv[]) { @@ -34,10 +31,14 @@ int main(int argc, char *argv[]) // Enable antialiasing viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + viewer.addImportPath(QString::fromLatin1("%1/../../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); #endif viewer.setTitle(QStringLiteral("QML Custom Input")); diff --git a/examples/qmllegend/main.cpp b/examples/qmllegend/main.cpp index f3210dd7..881297f6 100644 --- a/examples/qmllegend/main.cpp +++ b/examples/qmllegend/main.cpp @@ -16,14 +16,11 @@ ** ****************************************************************************/ +#include "qtquick2applicationviewer.h" #include + #include -#include "qtquick2applicationviewer.h" -#ifdef Q_OS_ANDROID -#include -#include -#endif -#include +#include int main(int argc, char *argv[]) { @@ -34,10 +31,14 @@ int main(int argc, char *argv[]) // Enable antialiasing viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + viewer.addImportPath(QString::fromLatin1("%1/../../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); #endif viewer.setTitle(QStringLiteral("Legend example")); diff --git a/examples/qmlmultigraph/main.cpp b/examples/qmlmultigraph/main.cpp index 12c52019..95201da5 100644 --- a/examples/qmlmultigraph/main.cpp +++ b/examples/qmlmultigraph/main.cpp @@ -16,14 +16,11 @@ ** ****************************************************************************/ +#include "qtquick2applicationviewer.h" #include + #include -#include "qtquick2applicationviewer.h" -#ifdef Q_OS_ANDROID -#include -#include -#endif -#include +#include int main(int argc, char *argv[]) { @@ -34,10 +31,14 @@ int main(int argc, char *argv[]) // Enable antialiasing viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + viewer.addImportPath(QString::fromLatin1("%1/../../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); #endif viewer.setTitle(QStringLiteral("QML multigraph example")); viewer.setSource(QUrl("qrc:/qml/qmlmultigraph/main.qml")); diff --git a/examples/qmloscilloscope/main.cpp b/examples/qmloscilloscope/main.cpp index 8cbaba71..175dfa1c 100644 --- a/examples/qmloscilloscope/main.cpp +++ b/examples/qmloscilloscope/main.cpp @@ -17,14 +17,11 @@ ****************************************************************************/ #include "datasource.h" +#include "qtquick2applicationviewer.h" #include + #include -#include "qtquick2applicationviewer.h" -#ifdef Q_OS_ANDROID #include -#include -#endif -#include #include int main(int argc, char *argv[]) @@ -36,10 +33,14 @@ int main(int argc, char *argv[]) // Enable antialiasing viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + viewer.addImportPath(QString::fromLatin1("%1/../../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); #endif viewer.setTitle(QStringLiteral("Oscilloscope example")); diff --git a/examples/qmlscatter/main.cpp b/examples/qmlscatter/main.cpp index 38422cb3..e9153289 100644 --- a/examples/qmlscatter/main.cpp +++ b/examples/qmlscatter/main.cpp @@ -16,14 +16,11 @@ ** ****************************************************************************/ +#include "qtquick2applicationviewer.h" #include + #include -#include "qtquick2applicationviewer.h" -#ifdef Q_OS_ANDROID -#include -#include -#endif -#include +#include int main(int argc, char *argv[]) { @@ -36,10 +33,14 @@ int main(int argc, char *argv[]) viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); //! [2] -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + viewer.addImportPath(QString::fromLatin1("%1/../../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); #endif viewer.setTitle(QStringLiteral("QML scatter example")); //! [0] diff --git a/examples/qmlsurface/main.cpp b/examples/qmlsurface/main.cpp index bddd1518..1ea70735 100644 --- a/examples/qmlsurface/main.cpp +++ b/examples/qmlsurface/main.cpp @@ -16,14 +16,11 @@ ** ****************************************************************************/ -#include -#include #include "qtquick2applicationviewer.h" +#include -#ifdef Q_OS_ANDROID -#include -#include -#endif +#include +#include int main(int argc, char *argv[]) { @@ -34,10 +31,14 @@ int main(int argc, char *argv[]) // Enable antialiasing viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + viewer.addImportPath(QString::fromLatin1("%1/../../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); #endif viewer.setSource(QUrl("qrc:/qml/qml/qmlsurface/main.qml")); diff --git a/examples/qmlsurfacelayers/main.cpp b/examples/qmlsurfacelayers/main.cpp index 51925c45..434008c4 100644 --- a/examples/qmlsurfacelayers/main.cpp +++ b/examples/qmlsurfacelayers/main.cpp @@ -16,14 +16,11 @@ ** ****************************************************************************/ -#include -#include #include "qtquick2applicationviewer.h" +#include -#ifdef Q_OS_ANDROID -#include -#include -#endif +#include +#include int main(int argc, char *argv[]) { @@ -34,10 +31,14 @@ int main(int argc, char *argv[]) // Enable antialiasing viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + viewer.addImportPath(QString::fromLatin1("%1/../../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/../../%2").arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); #endif viewer.setSource(QUrl("qrc:/qml/qmlsurfacelayers/main.qml")); diff --git a/examples/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml b/examples/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml index ba9961b5..22c527a2 100644 --- a/examples/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml +++ b/examples/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml @@ -204,12 +204,12 @@ Item { if (surfaceLayers.selectionMode & AbstractGraph3D.SelectionMultiSeries) { surfaceLayers.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice - text: "Slice All Layers" + text = "Slice All Layers" } else { surfaceLayers.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice | AbstractGraph3D.SelectionMultiSeries - text: "Slice One Layer" + text = "Slice One Layer" } } } @@ -223,10 +223,10 @@ Item { onClicked: { if (surfaceLayers.shadowQuality === AbstractGraph3D.ShadowQualityNone) { surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityLow - text: "Hide Shadows" + text = "Hide Shadows" } else { surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityNone - text: "Show Shadows" + text = "Show Shadows" } } } -- cgit v1.2.3