From ef94f64ce15a446e3d0f14569ef45894b86a4b4f 2012-02-21 11:59:41 From: Michal Klocek Date: 2012-02-21 11:59:41 Subject: [PATCH] Add qmlplugin support for integrated build --- diff --git a/common.pri b/common.pri index a37e6ba..97d8da7 100644 --- a/common.pri +++ b/common.pri @@ -5,6 +5,7 @@ CHART_BUILD_PRIVATE_HEADER_DIR = $$CHART_BUILD_PUBLIC_HEADER_DIR/private CHART_BUILD_LIB_DIR = $$PWD/lib CHART_BUILD_DIR = $$PWD/build CHART_BUILD_BIN_DIR = $$PWD/bin +CHART_BUILD_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR/QtCommercial/Chart # hack to fix windows builds win32:{ @@ -13,6 +14,7 @@ win32:{ CHART_BUILD_LIB_DIR = $$replace(CHART_BUILD_LIB_DIR, "/","\\") CHART_BUILD_BUILD_DIR = $$replace(CHART_BUILD_BUILD_DIR, "/","\\") CHART_BUILD_BIN_DIR = $$replace(CHART_BUILD_BIN_DIR, "/","\\") + CHART_BUILD_PLUGIN_DIR = $$replace(CHART_BUILD_PLUGIN_DIR, "/","\\") } mac: { diff --git a/qmlplugin/qmlplugin.pro b/qmlplugin/qmlplugin.pro index 3416541..0c4eb90 100644 --- a/qmlplugin/qmlplugin.pro +++ b/qmlplugin/qmlplugin.pro @@ -7,7 +7,7 @@ TEMPLATE = lib TARGET = qtcommercialchartqml - +DESTDIR = $$CHART_BUILD_PLUGIN_DIR CONFIG += qt plugin QT += declarative @@ -16,10 +16,10 @@ contains(QT_MAJOR_VERSION, 5) { DEFINES += QTQUICK2 } -OBJECTS_DIR = $$CHART_BUILD_DIR/lib -MOC_DIR = $$CHART_BUILD_DIR/lib -UI_DIR = $$CHART_BUILD_DIR/lib -RCC_DIR = $$CHART_BUILD_DIR/lib +OBJECTS_DIR = $$CHART_BUILD_DIR/plugin +MOC_DIR = $$CHART_BUILD_DIR/plugin +UI_DIR = $$CHART_BUILD_DIR/plugin +RCC_DIR = $$CHART_BUILD_DIR/plugin SOURCES += \ plugin.cpp \ @@ -37,6 +37,8 @@ HEADERS += \ declarativepieseries.h \ declarativelineseries.h +QMAKE_POST_LINK = $$QMAKE_COPY qmldir $$CHART_BUILD_PLUGIN_DIR + TARGETPATH = QtCommercial/Chart target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir diff --git a/test/qmlchart/main.cpp b/test/qmlchart/main.cpp index ac70a83..15a8fb8 100644 --- a/test/qmlchart/main.cpp +++ b/test/qmlchart/main.cpp @@ -8,7 +8,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QScopedPointer viewer(QmlApplicationViewer::create()); viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer->setMainQmlFile(QLatin1String("qml/qmlchart/main.qml")); + viewer->setSource(QUrl("qrc:/qml/qmlchart/loader.qml")); viewer->showExpanded(); return app->exec(); diff --git a/test/qmlchart/qml/qmlchart/loader.qml b/test/qmlchart/qml/qmlchart/loader.qml new file mode 100644 index 0000000..d6b44b7 --- /dev/null +++ b/test/qmlchart/qml/qmlchart/loader.qml @@ -0,0 +1,17 @@ +import QtQuick 1.0 + +Item { + id: container + width: 400 + height: 500 + Component.onCompleted: { + var co = Qt.createComponent("main.qml") + if (co.status == Component.Ready) { + var o = co.createObject(container) + } else { + console.log(co.errorString()) + console.log("QtCommercial.Chart 1.1 not available") + console.log("Please use correct QML_IMPORT_PATH export") + } + } +} \ No newline at end of file diff --git a/test/qmlchart/qml/qmlchart/main.qml b/test/qmlchart/qml/qmlchart/main.qml index 7988a5c..4cecfa2 100644 --- a/test/qmlchart/qml/qmlchart/main.qml +++ b/test/qmlchart/qml/qmlchart/main.qml @@ -2,8 +2,8 @@ import QtQuick 1.0 import QtCommercial.Chart 1.0 Rectangle { - width: 360 - height: 360 + width: parent.width + height: parent.height // Another option for QML data api: // ListModel { diff --git a/test/qmlchart/qmlchart.pro b/test/qmlchart/qmlchart.pro index 3927027..ed8d5f0 100644 --- a/test/qmlchart/qmlchart.pro +++ b/test/qmlchart/qmlchart.pro @@ -1,18 +1,21 @@ !include( ../../common.pri ) { error( "Couldn't find the common.pri file!" ) } -!include( ../../integrated.pri ) { - error( "Couldn't find the integrated.pri file !") -} -integrated_build: { - # cannot use integrated build for now; we would need the qml files copied to - # charts/bin folder also to make this work. And even in that case I'm not sure if - # the chart qml plugin can be found or if it needs to be installed to the qt's plugin - # folder always. - warning("TODO: Charts qml test app does not work with integrated builds") +DESTDIR = $$CHART_BUILD_BIN_DIR + +OBJECTS_DIR = $$CHART_BUILD_DIR/bin/$$TARGET +MOC_DIR = $$CHART_BUILD_DIR/bin/$$TARGET +UI_DIR = $$CHART_BUILD_DIR/bin/$$TARGET +RCC_DIR = $$CHART_BUILD_DIR/bin/$$TARGET + +integrated_build:{ + message(Please export QML_IMPORT_PATH=$$CHART_BUILD_LIB_DIR) } +RESOURCES += \ + resources.qrc + # Add more folders to ship with the application, here folder_01.source = qml/qmlchart folder_01.target = qml diff --git a/test/qmlchart/resources.qrc b/test/qmlchart/resources.qrc new file mode 100644 index 0000000..a9c2b4a --- /dev/null +++ b/test/qmlchart/resources.qrc @@ -0,0 +1,6 @@ + + + qml/qmlchart/loader.qml + qml/qmlchart/main.qml + +