##// END OF EJS Templates
Add qmlplugin support for integrated build
Michal Klocek -
r255:ef94f64ce15a
parent child
Show More
@@ -0,0 +1,17
1 import QtQuick 1.0
2
3 Item {
4 id: container
5 width: 400
6 height: 500
7 Component.onCompleted: {
8 var co = Qt.createComponent("main.qml")
9 if (co.status == Component.Ready) {
10 var o = co.createObject(container)
11 } else {
12 console.log(co.errorString())
13 console.log("QtCommercial.Chart 1.1 not available")
14 console.log("Please use correct QML_IMPORT_PATH export")
15 }
16 }
17 } No newline at end of file
@@ -0,0 +1,6
1 <RCC>
2 <qresource prefix="/">
3 <file>qml/qmlchart/loader.qml</file>
4 <file>qml/qmlchart/main.qml</file>
5 </qresource>
6 </RCC>
@@ -1,25 +1,27
1 1 CONFIG+=integrated_build #remove if you want to build against installed libs
2 2
3 3 CHART_BUILD_PUBLIC_HEADER_DIR = $$PWD/include
4 4 CHART_BUILD_PRIVATE_HEADER_DIR = $$CHART_BUILD_PUBLIC_HEADER_DIR/private
5 5 CHART_BUILD_LIB_DIR = $$PWD/lib
6 6 CHART_BUILD_DIR = $$PWD/build
7 7 CHART_BUILD_BIN_DIR = $$PWD/bin
8 CHART_BUILD_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR/QtCommercial/Chart
8 9
9 10 # hack to fix windows builds
10 11 win32:{
11 12 CHART_BUILD_PUBLIC_HEADER_DIR = $$replace(CHART_BUILD_PUBLIC_HEADER_DIR, "/","\\")
12 13 CHART_BUILD_PRIVATE_HEADER_DIR = $$replace(CHART_BUILD_PRIVATE_HEADER_DIR, "/","\\")
13 14 CHART_BUILD_LIB_DIR = $$replace(CHART_BUILD_LIB_DIR, "/","\\")
14 15 CHART_BUILD_BUILD_DIR = $$replace(CHART_BUILD_BUILD_DIR, "/","\\")
15 16 CHART_BUILD_BIN_DIR = $$replace(CHART_BUILD_BIN_DIR, "/","\\")
17 CHART_BUILD_PLUGIN_DIR = $$replace(CHART_BUILD_PLUGIN_DIR, "/","\\")
16 18 }
17 19
18 20 mac: {
19 21 # TODO: The following qmake flags are a work-around to make QtCommercial Charts compile on
20 22 # QtCommercial 4.8. On the other hand Charts builds successfully with Qt open source 4.8
21 23 # without these definitions, so this is probably a configuration issue on QtCommercial 4.8;
22 24 # it should probably define the minimum OSX version to be 10.5...
23 25 QMAKE_CXXFLAGS *= -mmacosx-version-min=10.5
24 26 QMAKE_LFLAGS *= -mmacosx-version-min=10.5
25 27 }
@@ -1,65 +1,67
1 1 !include( ../common.pri ) {
2 2 error( "Couldn't find the common.pri file!" )
3 3 }
4 4 !include( ../integrated.pri ) {
5 5 error( "Couldn't find the integrated.pri file !")
6 6 }
7 7
8 8 TEMPLATE = lib
9 9 TARGET = qtcommercialchartqml
10
10 DESTDIR = $$CHART_BUILD_PLUGIN_DIR
11 11 CONFIG += qt plugin
12 12 QT += declarative
13 13
14 14 contains(QT_MAJOR_VERSION, 5) {
15 15 # TODO: QtQuick2 not supported by the implementation currently
16 16 DEFINES += QTQUICK2
17 17 }
18 18
19 OBJECTS_DIR = $$CHART_BUILD_DIR/lib
20 MOC_DIR = $$CHART_BUILD_DIR/lib
21 UI_DIR = $$CHART_BUILD_DIR/lib
22 RCC_DIR = $$CHART_BUILD_DIR/lib
19 OBJECTS_DIR = $$CHART_BUILD_DIR/plugin
20 MOC_DIR = $$CHART_BUILD_DIR/plugin
21 UI_DIR = $$CHART_BUILD_DIR/plugin
22 RCC_DIR = $$CHART_BUILD_DIR/plugin
23 23
24 24 SOURCES += \
25 25 plugin.cpp \
26 26 declarativechart.cpp \
27 27 declarativeseries.cpp \
28 28 declarativescatterseries.cpp \
29 29 scatterelement.cpp \
30 30 declarativepieseries.cpp \
31 31 declarativelineseries.cpp
32 32 HEADERS += \
33 33 declarativechart.h \
34 34 declarativeseries.h \
35 35 declarativescatterseries.h \
36 36 scatterelement.h \
37 37 declarativepieseries.h \
38 38 declarativelineseries.h
39 39
40 QMAKE_POST_LINK = $$QMAKE_COPY qmldir $$CHART_BUILD_PLUGIN_DIR
41
40 42 TARGETPATH = QtCommercial/Chart
41 43 target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
42 44 qmldir.files += $$PWD/qmldir
43 45 qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
44 46
45 47 INSTALLS += target qmldir
46 48
47 49
48 50
49 51
50 52
51 53
52 54
53 55
54 56
55 57
56 58
57 59
58 60
59 61
60 62
61 63
62 64
63 65
64 66
65 67
@@ -1,15 +1,15
1 1 #include <QtGui/QApplication>
2 2 #include <QDeclarativeEngine>
3 3 #include "qmlapplicationviewer.h"
4 4
5 5 Q_DECL_EXPORT int main(int argc, char *argv[])
6 6 {
7 7 QScopedPointer<QApplication> app(createApplication(argc, argv));
8 8 QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
9 9
10 10 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
11 viewer->setMainQmlFile(QLatin1String("qml/qmlchart/main.qml"));
11 viewer->setSource(QUrl("qrc:/qml/qmlchart/loader.qml"));
12 12 viewer->showExpanded();
13 13
14 14 return app->exec();
15 15 }
@@ -1,112 +1,112
1 1 import QtQuick 1.0
2 2 import QtCommercial.Chart 1.0
3 3
4 4 Rectangle {
5 width: 360
6 height: 360
5 width: parent.width
6 height: parent.height
7 7
8 8 // Another option for QML data api:
9 9 // ListModel {
10 10 // id: listModelForPie
11 11 // // PieDataElement
12 12 // ListElement {
13 13 // label: "Apple"
14 14 // value: 4.3
15 15 // }
16 16 // ListElement {
17 17 // label: "Blackberry"
18 18 // value: 15.1
19 19 // }
20 20 // }
21 21
22 22 Component.onCompleted: {
23 23 // console.log("Component.onCompleted: " + ChartPointElement.x);
24 24 // console.log("Component.onCompleted: " + ChartPointElement.y);
25 25 // console.log("Component.onCompleted: " + ChartPointElement.dataX);
26 26 // console.log("Component.onCompleted: " + ChartPointElement.dataY);
27 27 //console.log("Component.onCompleted: " + chartModel.get(0).x);
28 28 //console.log("Component.onCompleted: " + chartModel.ChartPointElements);
29 29 // console.log("Component.onCompleted: " + elementt.dataX);
30 30 // console.log("Component.onCompleted: " + chartModel.get(0).dataX);
31 31 //ChartPointElement { x: 0.3; y: 0.3 }
32 32 }
33 33
34 34 Chart {
35 35 id: chart1
36 36 anchors.top: parent.top
37 37 anchors.left: parent.left
38 38 anchors.right: parent.right
39 39 height: parent.height / 2
40 40 theme: Chart.ThemeVanilla
41 41
42 42 PieSeries {
43 43 data: [
44 44 // TODO: "NnElement" matches the naming convention of for example ListModel...
45 45 // But PieSlice would match the naming of QtCommercial Charts C++ api
46 46 ChartPieElement { label: "Volkswagen"; value: 13.5 },
47 47 ChartPieElement { label: "Toyota"; value: 10.9 },
48 48 ChartPieElement { label: "Ford"; value: 8.6 },
49 49 ChartPieElement { label: "Skoda"; value: 8.2 },
50 50 ChartPieElement { label: "Volvo"; value: 6.8 },
51 51 ChartPieElement { label: "Others"; value: 52.0 }
52 52 ]
53 53 }
54 54
55 55 // Series {
56 56 // seriesType: Series.SeriesTypeLine
57 57 // }
58 58 // TODO:
59 59 // Series {
60 60 // seriesType: Series.SeriesTypeBar
61 61 // }
62 62 }
63 63
64 64
65 65 Chart {
66 66 id: chart2
67 67 anchors.top: chart1.bottom
68 68 anchors.bottom: parent.bottom
69 69 anchors.left: parent.left
70 70 anchors.right: parent.right
71 71 theme: Chart.ThemeScientific
72 72
73 73 LineSeries {
74 74 data: [
75 75 ChartPointElement { x: 0.0; y: 0.0 },
76 76 ChartPointElement { x: 1.1; y: 2.1 },
77 77 ChartPointElement { x: 2.9; y: 4.9 },
78 78 ChartPointElement { x: 3.2; y: 3.0 }
79 79 ]
80 80 }
81 81
82 82 ScatterSeries {
83 83 data: [
84 84 ChartPointElement { x: 1.1; y: 1.1 },
85 85 ChartPointElement { x: 1.1; y: 1.2 },
86 86 ChartPointElement { x: 1.17; y: 1.15 }
87 87 ]
88 88 }
89 89 ScatterSeries {
90 90 data: [
91 91 ChartPointElement { x: 1.5; y: 1.5 },
92 92 ChartPointElement { x: 1.5; y: 1.6 },
93 93 ChartPointElement { x: 1.57; y: 1.55 }
94 94 ]
95 95 }
96 96 ScatterSeries {
97 97 data: [
98 98 ChartPointElement { x: 2.0; y: 2.0 },
99 99 ChartPointElement { x: 2.0; y: 2.1 },
100 100 ChartPointElement { x: 2.07; y: 2.05 }
101 101 ]
102 102 }
103 103 ScatterSeries {
104 104 id: scatter4
105 105 data: [
106 106 ChartPointElement { x: 2.6; y: 2.6 },
107 107 ChartPointElement { x: 2.6; y: 2.7 },
108 108 ChartPointElement { x: 2.67; y: 2.65 }
109 109 ]
110 110 }
111 111 }
112 112 }
@@ -1,56 +1,59
1 1 !include( ../../common.pri ) {
2 2 error( "Couldn't find the common.pri file!" )
3 3 }
4 !include( ../../integrated.pri ) {
5 error( "Couldn't find the integrated.pri file !")
6 }
7 4
8 integrated_build: {
9 # cannot use integrated build for now; we would need the qml files copied to
10 # charts/bin folder also to make this work. And even in that case I'm not sure if
11 # the chart qml plugin can be found or if it needs to be installed to the qt's plugin
12 # folder always.
13 warning("TODO: Charts qml test app does not work with integrated builds")
5 DESTDIR = $$CHART_BUILD_BIN_DIR
6
7 OBJECTS_DIR = $$CHART_BUILD_DIR/bin/$$TARGET
8 MOC_DIR = $$CHART_BUILD_DIR/bin/$$TARGET
9 UI_DIR = $$CHART_BUILD_DIR/bin/$$TARGET
10 RCC_DIR = $$CHART_BUILD_DIR/bin/$$TARGET
11
12 integrated_build:{
13 message(Please export QML_IMPORT_PATH=$$CHART_BUILD_LIB_DIR)
14 14 }
15 15
16 RESOURCES += \
17 resources.qrc
18
16 19 # Add more folders to ship with the application, here
17 20 folder_01.source = qml/qmlchart
18 21 folder_01.target = qml
19 22 DEPLOYMENTFOLDERS = folder_01
20 23
21 24 # Additional import path used to resolve QML modules in Creator's code model
22 25 QML_IMPORT_PATH =
23 26
24 27 symbian:TARGET.UID3 = 0xE421236E
25 28
26 29 # Smart Installer package's UID
27 30 # This UID is from the protected range and therefore the package will
28 31 # fail to install if self-signed. By default qmake uses the unprotected
29 32 # range value if unprotected UID is defined for the application and
30 33 # 0x2002CCCF value if protected UID is given to the application
31 34 #symbian:DEPLOYMENT.installer_header = 0x2002CCCF
32 35
33 36 # Allow network access on Symbian
34 37 symbian:TARGET.CAPABILITY += NetworkServices
35 38
36 39 # If your application uses the Qt Mobility libraries, uncomment the following
37 40 # lines and add the respective components to the MOBILITY variable.
38 41 # CONFIG += mobility
39 42 # MOBILITY +=
40 43
41 44 # Speed up launching on MeeGo/Harmattan when using applauncherd daemon
42 45 # CONFIG += qdeclarative-boostable
43 46
44 47 # Add dependency to Symbian components
45 48 # CONFIG += qt-components
46 49
47 50 # The .cpp file which was generated for your project. Feel free to hack it.
48 51 SOURCES += main.cpp
49 52
50 53 # Please do not modify the following two lines. Required for deployment.
51 54 include(qmlapplicationviewer/qmlapplicationviewer.pri)
52 55 qtcAddDeployment()
53 56
54 57 #HEADERS += \
55 58 # chart.h
56 59
General Comments 0
You need to be logged in to leave comments. Login now