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