##// END OF EJS Templates
Add possibility to set brush image via QML API...
Titta Heikkala -
r2681:8344a0102a72
parent child
Show More
@@ -0,0 +1,107
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest BarCategoryAxis 1.3"
32 when: windowShown
33
34 function test_minMax() {
35 compare(barSeries1.axisX.min, "Jan", "AxisX min");
36 compare(barSeries1.axisX.max, "Jun", "AxisX max");
37 compare(barSeries1.axisY.min, 0, "AxisY min");
38 compare(barSeries1.axisY.max, 10, "AxisY max");
39 }
40
41 function test_categories() {
42 compare(barSeries1.axisX.count, 6, "AxisX count");
43 categoriesCountChangedSpy.clear();
44 categoriesChangedSpy.clear();
45
46 // Replace categories
47 barSeries1.axisX.categories = ["Tam", "Hel", "Maa", "Huh"];
48 compare(barSeries1.axisX.count, 4, "AxisX count");
49 compare(categoriesCountChangedSpy.count, 1, "onCountChanged");
50 compare(categoriesChangedSpy.count, 1, "onCategoriesChanged");
51
52 // Reset the original categories
53 barSeries1.axisX.categories = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
54 compare(barSeries1.axisX.count, 6, "AxisX count");
55 compare(categoriesCountChangedSpy.count, 2, "onCountChanged");
56 compare(categoriesChangedSpy.count, 2, "onCategoriesChanged");
57 }
58
59 function test_minMaxChanged() {
60 axisY.min = -1;
61 compare(minChangedSpy.count, 1, "onMinChanged");
62 compare(maxChangedSpy.count, 0, "onMaxChanged");
63 axisY.max = 12;
64 compare(minChangedSpy.count, 1, "onMinChanged");
65 compare(maxChangedSpy.count, 1, "onMaxChanged");
66 }
67 }
68
69 ChartView {
70 id: chartView
71 anchors.fill: parent
72
73 BarSeries {
74 id: barSeries1
75 axisX: BarCategoryAxis {
76 id: axisX
77 categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ]
78 }
79 axisY: ValuesAxis {
80 id: axisY
81 min: 0
82 max: 10
83 }
84 }
85
86 SignalSpy {
87 id: categoriesCountChangedSpy
88 target: axisX
89 signalName: "countChanged"
90 }
91 SignalSpy {
92 id: categoriesChangedSpy
93 target: axisX
94 signalName: "categoriesChanged"
95 }
96 SignalSpy {
97 id: minChangedSpy
98 target: axisY
99 signalName: "minChanged"
100 }
101 SignalSpy {
102 id: maxChangedSpy
103 target: axisY
104 signalName: "maxChanged"
105 }
106 }
107 }
@@ -0,0 +1,146
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest BarSeries 1.3"
32 when: windowShown
33
34 function test_properties() {
35 compare(barSeries.barWidth, 0.5);
36 compare(barSeries.labelsVisible, false);
37 }
38
39 function test_axes() {
40 verify(chartView.axisX() == barSeries.axisX);
41 verify(chartView.axisY() == barSeries.axisY);
42
43 compare(barSeries.axisX, stackedBarSeries.axisX);
44 compare(barSeries.axisY, stackedBarSeries.axisY);
45
46 compare(barSeries.axisX, percentBarSeries.axisX);
47 compare(barSeries.axisY, percentBarSeries.axisY);
48 }
49
50 function test_append() {
51 var setCount = 5;
52 var valueCount = 50;
53 addedSpy.clear();
54 append(setCount, valueCount);
55
56 compare(barSeries.count, setCount);
57 for (var k = 0; k < setCount; k++) {
58 compare(barSeries.at(k).count, valueCount);
59 compare(barSeries.at(k).label, "barset" + k);
60 }
61 compare(addedSpy.count, setCount);
62
63 barSeries.clear();
64 compare(barSeries.count, 0);
65 }
66
67 function test_insert() {
68 var setCount = 5;
69 var valueCount = 50;
70 addedSpy.clear();
71 append(setCount, valueCount);
72
73 for (var i = 0; i < setCount; i++) {
74 var values = [];
75 for (var j = 0; j < valueCount; j++)
76 values[j] = Math.random() * 10;
77 var set = barSeries.insert(i, "barset" + i, values);
78 compare(set.label, "barset" + i);
79 }
80
81 compare(barSeries.count, setCount * 2);
82 for (var k = 0; k < setCount * 2; k++)
83 compare(barSeries.at(k).count, valueCount);
84 compare(addedSpy.count, 2 * setCount);
85
86 barSeries.clear();
87 compare(barSeries.count, 0);
88 }
89
90 function test_remove() {
91 var setCount = 5;
92 var valueCount = 50;
93 removedSpy.clear();
94 append(setCount, valueCount);
95
96 for (var k = 0; k < setCount; k++)
97 barSeries.remove(barSeries.at(0));
98
99 compare(barSeries.count, 0);
100 compare(removedSpy.count, setCount);
101 }
102
103 // Not a test function, used by one or more test functions
104 function append(setCount, valueCount) {
105 for (var i = 0; i < setCount; i++) {
106 var values = [];
107 for (var j = 0; j < valueCount; j++)
108 values[j] = Math.random() * 10;
109 barSeries.append("barset" + i, values);
110 }
111 }
112 }
113
114 ChartView {
115 id: chartView
116 anchors.fill: parent
117
118 BarSeries {
119 id: barSeries
120 name: "bar"
121 axisX: BarCategoryAxis {}
122 axisY: ValueAxis { min: 0; max: 10 }
123
124 SignalSpy {
125 id: addedSpy
126 target: barSeries
127 signalName: "barsetsAdded"
128 }
129 SignalSpy {
130 id: removedSpy
131 target: barSeries
132 signalName: "barsetsRemoved"
133 }
134 }
135
136 StackedBarSeries {
137 id: stackedBarSeries
138 name: "stackedBar"
139 }
140
141 PercentBarSeries {
142 id: percentBarSeries
143 name: "percentBar"
144 }
145 }
146 }
@@ -0,0 +1,96
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest BoxPlotSeries 1.3"
32 when: windowShown
33
34 function test_properties() {
35 compare(boxPlotSeries.boxWidth, 0.5);
36 }
37
38 function test_setproperties() {
39 var set = boxPlotSeries.append("boxplot", [1, 2, 5, 6, 8]);
40 compare(set.label, "boxplot");
41 compare(set.count, 5);
42 }
43
44 function test_append() {
45 addedSpy.clear();
46 countChangedSpy.clear();
47 var count = 50;
48 for (var i = 0; i < count; i++)
49 boxPlotSeries.append("boxplot" + i, Math.random());
50 compare(addedSpy.count, count);
51 compare(countChangedSpy.count, count);
52 console.log("Check the series count once QTRD-2504 is implemented");
53 boxPlotSeries.clear();
54 }
55
56 function test_remove() {
57 removedSpy.clear();
58 countChangedSpy.clear();
59 var count = 50;
60 for (var i = 0; i < count; i++)
61 boxPlotSeries.append("boxplot" + i, Math.random());
62 for (var j = 0; j < count; j++)
63 boxPlotSeries.remove(boxPlotSeries.at(0));
64 compare(removedSpy.count, count);
65 compare(countChangedSpy.count, 2 * count);
66 console.log("Check the series count once QTRD-2504 is implemented");
67 }
68 }
69
70 ChartView {
71 id: chartView
72 anchors.fill: parent
73
74 BoxPlotSeries {
75 id: boxPlotSeries
76 name: "boxplot"
77 BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
78
79 SignalSpy {
80 id: addedSpy
81 target: boxPlotSeries
82 signalName: "boxsetsAdded"
83 }
84 SignalSpy {
85 id: removedSpy
86 target: boxPlotSeries
87 signalName: "boxsetsRemoved"
88 }
89 SignalSpy {
90 id: countChangedSpy
91 target: boxPlotSeries
92 signalName: "countChanged"
93 }
94 }
95 }
96 }
@@ -0,0 +1,84
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest CategoryAxis 1.3"
32 when: windowShown
33
34 function test_minMax() {
35 compare(lineSeries1.axisX.min, 0, "AxisX min");
36 compare(lineSeries1.axisX.max, 10, "AxisX max");
37 compare(lineSeries1.axisY.min, 0, "AxisY min");
38 compare(lineSeries1.axisY.max, 10, "AxisY max");
39 }
40
41 function test_categories() {
42 compare(lineSeries1.axisY.startValue, 0, "AxisY start value");
43 compare(lineSeries1.axisY.count, 3, "AxisY count");
44 compare(lineSeries1.axisY.categoriesLabels[0], "label0", "AxisY categories labels");
45 compare(lineSeries1.axisY.categoriesLabels[1], "label1", "AxisY categories labels");
46 compare(lineSeries1.axisY.categoriesLabels[2], "label2", "AxisY categories labels");
47 }
48 }
49
50 ChartView {
51 id: chartView
52 anchors.fill: parent
53
54 LineSeries {
55 id: lineSeries1
56 axisX: ValuesAxis {
57 id: axisX
58 min: 0
59 max: 10
60 }
61 axisY: CategoryAxis {
62 id: axisY
63 min: 0
64 max: 10
65 startValue: 0
66 CategoryRange {
67 label: "label0"
68 endValue: 1
69 }
70 CategoryRange {
71 label: "label1"
72 endValue: 3
73 }
74 CategoryRange {
75 label: "label2"
76 endValue: 10
77 }
78 }
79 XYPoint { x: -1; y: -1 }
80 XYPoint { x: 0; y: 0 }
81 XYPoint { x: 5; y: 5 }
82 }
83 }
84 }
@@ -0,0 +1,80
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest ChartView Properties 1.3"
32 when: windowShown
33
34 function test_chartViewProperties() {
35 compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions");
36 verify(chartView.backgroundColor != undefined);
37 verify(chartView.margins.bottom > 0, "ChartView.margins.bottom");
38 verify(chartView.margins.top > 0, "ChartView.margins.top");
39 verify(chartView.margins.left > 0, "ChartView.margins.left");
40 verify(chartView.margins.right > 0, "ChartView.margins.right");
41 compare(chartView.count, 0, "ChartView.count");
42 compare(chartView.dropShadowEnabled, false, "ChartView.dropShadowEnabled");
43 verify(chartView.plotArea.height > 0, "ChartView.plotArea.height");
44 verify(chartView.plotArea.width > 0, "ChartView.plotArea.width");
45 verify(chartView.plotArea.x > 0, "ChartView.plotArea.x");
46 verify(chartView.plotArea.y > 0, "ChartView.plotArea.y");
47 compare(chartView.theme, ChartView.ChartThemeLight, "ChartView.theme");
48 compare(chartView.title, "", "ChartView.title");
49 compare(chartView.title, "", "ChartView.title");
50 verify(chartView.titleColor != undefined, "ChartView.titleColor");
51 compare(chartView.titleFont.bold, false, "ChartView.titleFont.bold");
52 // Legend
53 compare(chartView.legend.visible, true, "ChartView.legend.visible");
54 compare(chartView.legend.alignment, Qt.AlignTop, "ChartView.legend.alignment");
55 compare(chartView.legend.backgroundVisible, false, "ChartView.legend.backgroundVisible");
56 verify(chartView.legend.borderColor != undefined, "ChartView.legend.borderColor");
57 verify(chartView.legend.color != undefined, "ChartView.legend.color");
58 compare(chartView.legend.reverseMarkers, false, "ChartView.legend.reverseMarkers");
59 // Legend font
60 compare(chartView.legend.font.bold, false, "ChartView.legend.font.bold");
61 compare(chartView.legend.font.capitalization, Font.MixedCase, "ChartView.legend.font.capitalization");
62 verify(chartView.legend.font.family != "", "ChartView.legend.font.family");
63 compare(chartView.legend.font.italic, false, "ChartView.legend.font.italic");
64 compare(chartView.legend.font.letterSpacing, 0.0, "ChartView.legend.font.letterSpacing");
65 verify(chartView.legend.font.pixelSize > 0
66 && chartView.legend.font.pixelSize < 50, "ChartView.legend.font.pixelSize");
67 verify(chartView.legend.font.pointSize > 0
68 && chartView.legend.font.pointSize < 50, "ChartView.legend.font.pointSize");
69 compare(chartView.legend.font.strikeout, false, "ChartView.legend.font.strikeout");
70 compare(chartView.legend.font.underline, false, "ChartView.legend.font.underline");
71 compare(chartView.legend.font.weight, Font.Normal, "ChartView.legend.font.weight");
72 compare(chartView.legend.font.wordSpacing, 0.0, "ChartView.legend.font.wordSpacing");
73 }
74 }
75
76 ChartView {
77 id: chartView
78 anchors.fill: parent
79 }
80 }
@@ -0,0 +1,160
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest ChartView Functions 1.3"
32 when: windowShown
33
34 function test_chartViewSeriesAndAxes() {
35 // Create XY series
36 var line = chartView.createSeries(ChartView.SeriesTypeLine, "line");
37 verify(line != null && line != undefined);
38 var spline = chartView.createSeries(ChartView.SeriesTypeSpline, "spline");
39 verify(spline != null && spline != undefined);
40 var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter");
41 verify(scatter != null && scatter != undefined);
42
43 // Create a series with specific axes
44 var line2 = chartView.createSeries(ChartView.SeriesTypeLine, "line2", chartView.axisX(line), chartView.axisY(line));
45
46 // Check that all the XY series use the same axes
47 verify(chartView.axisX(line) != null);
48 verify(chartView.axisY(line) != null);
49 compare(chartView.axisX(line), chartView.axisX(line2));
50 compare(chartView.axisY(line), chartView.axisY(line2));
51 compare(chartView.axisX(line), chartView.axisX(spline));
52 compare(chartView.axisY(line), chartView.axisY(spline));
53 compare(chartView.axisX(line), chartView.axisX(scatter));
54 compare(chartView.axisY(line), chartView.axisY(scatter));
55
56 var bar = chartView.createSeries(ChartView.SeriesTypeBar, "bar");
57 verify(bar != null && bar != undefined);
58 var stackedbar = chartView.createSeries(ChartView.SeriesTypeStackedBar, "stackedbar");
59 verify(stackedbar != null && stackedbar != undefined);
60 var percentbar = chartView.createSeries(ChartView.SeriesTypePercentBar, "percentbar");
61 verify(percentbar != null && percentbar != undefined);
62 var horizontalbar = chartView.createSeries(ChartView.SeriesTypeHorizontalBar, "horizontalbar");
63 verify(horizontalbar != null && horizontalbar != undefined);
64 var horizontalstackedbar = chartView.createSeries(ChartView.SeriesTypeHorizontalStackedBar, "horizontalstackedbar");
65 verify(horizontalstackedbar != null && horizontalstackedbar != undefined);
66 var horizontalpercentbar = chartView.createSeries(ChartView.SeriesTypeHorizontalPercentBar, "horizontalpercentbar");
67 verify(horizontalpercentbar != null && horizontalpercentbar != undefined);
68 var area = chartView.createSeries(ChartView.SeriesTypeArea, "area");
69 verify(area != null && area != undefined);
70
71 // Remove all series
72 chartView.removeAllSeries();
73 compare(chartView.count, 0);
74 }
75
76 function test_chartViewRange() {
77 // Set initial values
78 chartView.createSeries(ChartView.SeriesTypeLine, "line");
79 verify(chartView.axisX() != null);
80 verify(chartView.axisY() != null);
81 chartView.axisX().min = 1.0;
82 chartView.axisX().max = 2.0;
83 chartView.axisY().min = 1.0;
84 chartView.axisY().max = 2.0;
85
86 var xMax = chartView.axisX().max;
87 var xMin = chartView.axisX().min;
88 var yMax = chartView.axisY().max;
89 var yMin = chartView.axisY().min;
90
91 // zoom x 2.5
92 chartView.zoom(1.5);
93 verify(chartView.axisX().max < xMax);
94 verify(chartView.axisX().min > xMin);
95 verify(chartView.axisY().max < yMax);
96 verify(chartView.axisY().min > yMin);
97 xMax = chartView.axisX().max;
98 xMin = chartView.axisX().min;
99 yMax = chartView.axisY().max;
100 yMin = chartView.axisY().min;
101
102 // zoom x 0.5
103 chartView.zoom(0.5);
104 verify(chartView.axisX().max > xMax);
105 verify(chartView.axisX().min < xMin);
106 verify(chartView.axisY().max > yMax);
107 verify(chartView.axisY().min < yMin);
108 xMax = chartView.axisX().max;
109 xMin = chartView.axisX().min;
110 yMax = chartView.axisY().max;
111 yMin = chartView.axisY().min;
112
113 // Scroll up
114 chartView.scrollUp(10);
115 compare(chartView.axisX().max, xMax);
116 compare(chartView.axisX().min, xMin);
117 verify(chartView.axisY().max > yMax);
118 verify(chartView.axisY().min > yMin);
119 xMax = chartView.axisX().max;
120 xMin = chartView.axisX().min;
121 yMax = chartView.axisY().max;
122 yMin = chartView.axisY().min;
123
124 // Scroll down
125 chartView.scrollDown(10);
126 compare(chartView.axisX().max, xMax);
127 compare(chartView.axisX().min, xMin);
128 verify(chartView.axisY().max < yMax);
129 verify(chartView.axisY().min < yMin);
130 xMax = chartView.axisX().max;
131 xMin = chartView.axisX().min;
132 yMax = chartView.axisY().max;
133 yMin = chartView.axisY().min;
134
135 // Scroll left
136 chartView.scrollLeft(10);
137 verify(chartView.axisX().max < xMax);
138 verify(chartView.axisX().min < xMin);
139 compare(chartView.axisY().max, yMax);
140 compare(chartView.axisY().min, yMin);
141 xMax = chartView.axisX().max;
142 xMin = chartView.axisX().min;
143 yMax = chartView.axisY().max;
144 yMin = chartView.axisY().min;
145
146 // Scroll right
147 chartView.scrollRight(10);
148 verify(chartView.axisX().max > xMax);
149 verify(chartView.axisX().min > xMin);
150 compare(chartView.axisY().max, yMax);
151 compare(chartView.axisY().min, yMin);
152 }
153 }
154
155 ChartView {
156 id: chartView
157 anchors.fill: parent
158 title: "Chart"
159 }
160 }
@@ -0,0 +1,73
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest ChartView Signals 1.3"
32 when: windowShown
33
34 // Verify onSeriesAdded and onSeriesRemoved signals
35 function test_chartView() {
36 var series = chartView.createSeries(ChartView.SeriesTypeLine, "line");
37 seriesAddedSpy.wait();
38 compare(seriesAddedSpy.count, 1, "ChartView.onSeriesAdded");
39
40 // Modifying layout triggers more than one plotAreaChanged signal
41 chartView.titleFont.pixelSize = 50;
42 verify(plotAreaChangedSpy.count > 0, "ChartView.onPlotAreaChanged");
43
44 chartView.removeSeries(series);
45 seriesRemovedSpy.wait();
46 compare(seriesRemovedSpy.count, 1, "ChartView.onSeriesAdded");
47 }
48 }
49
50 ChartView {
51 id: chartView
52 anchors.fill: parent
53 title: "Chart"
54
55 SignalSpy {
56 id: plotAreaChangedSpy
57 target: chartView
58 signalName: "plotAreaChanged"
59 }
60
61 SignalSpy {
62 id: seriesAddedSpy
63 target: chartView
64 signalName: "seriesAdded"
65 }
66
67 SignalSpy {
68 id: seriesRemovedSpy
69 target: chartView
70 signalName: "seriesRemoved"
71 }
72 }
73 }
@@ -0,0 +1,131
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest PieSeries 1.3"
32 when: windowShown
33
34 function test_properties() {
35 compare(pieSeries.endAngle, 360);
36 compare(pieSeries.holeSize, 0);
37 compare(pieSeries.horizontalPosition, 0.5);
38 compare(pieSeries.size, 0.7);
39 compare(pieSeries.startAngle, 0);
40 compare(pieSeries.sum, 0);
41 compare(pieSeries.verticalPosition, 0.5);
42 }
43
44 function test_sliceproperties() {
45 var slice = pieSeries.append("slice", 10);
46 compare(slice.angleSpan, 360.0);
47 verify(slice.borderColor != undefined);
48 compare(slice.borderWidth, 1);
49 verify(slice.color != undefined);
50 compare(slice.explodeDistanceFactor, 0.15);
51 compare(slice.exploded, false);
52 compare(slice.label, "slice");
53 compare(slice.labelArmLengthFactor, 0.15);
54 verify(slice.labelColor != undefined);
55 compare(slice.labelFont.bold, false);
56 compare(slice.labelPosition, PieSlice.LabelOutside);
57 compare(slice.labelVisible, false);
58 compare(slice.percentage, 1.0);
59 compare(slice.startAngle, 0.0);
60 compare(slice.value, 10.0);
61 }
62
63 function test_append() {
64 addedSpy.clear();
65 countChangedSpy.clear();
66 sumChangedSpy.clear();
67 var count = 50;
68 for (var i = 0; i < count; i++)
69 pieSeries.append("slice" + i, Math.random());
70 compare(addedSpy.count, count);
71 compare(countChangedSpy.count, count);
72 compare(sumChangedSpy.count, count);
73 pieSeries.clear();
74 }
75
76 function test_remove() {
77 removedSpy.clear();
78 countChangedSpy.clear();
79 sumChangedSpy.clear();
80 var count = 50;
81 for (var i = 0; i < count; i++)
82 pieSeries.append("slice" + i, Math.random());
83 for (var j = 0; j < count; j++)
84 pieSeries.remove(pieSeries.at(0));
85 compare(removedSpy.count, count);
86 compare(countChangedSpy.count, 2 * count);
87 compare(sumChangedSpy.count, 2 * count);
88 compare(pieSeries.count, 0);
89 }
90
91 function test_find() {
92 var count = 50;
93 for (var i = 0; i < count; i++)
94 pieSeries.append("slice" + i, Math.random());
95 for (var j = 0; j < count; j++)
96 compare(pieSeries.find("slice" + j).label, "slice" + j);
97 pieSeries.clear();
98 }
99 }
100
101 ChartView {
102 id: chartView
103 anchors.fill: parent
104
105 PieSeries {
106 id: pieSeries
107 name: "pie"
108
109 SignalSpy {
110 id: addedSpy
111 target: pieSeries
112 signalName: "added"
113 }
114 SignalSpy {
115 id: removedSpy
116 target: pieSeries
117 signalName: "removed"
118 }
119 SignalSpy {
120 id: sumChangedSpy
121 target: pieSeries
122 signalName: "sumChanged"
123 }
124 SignalSpy {
125 id: countChangedSpy
126 target: pieSeries
127 signalName: "countChanged"
128 }
129 }
130 }
131 }
@@ -0,0 +1,116
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest ValueAxis 1.3"
32 when: windowShown
33
34 // test functions are run in alphabetical order, the name has 'a' so that it
35 // will be the first function to execute.
36 function test_a_properties() {
37 // Default properties
38 verify(axisX.min < 0, "AxisX min");
39 verify(axisX.max > 0, "AxisX max");
40 verify(axisY.min < 0, "AxisY min");
41 verify(axisY.max > 0, "AxisY max");
42 verify(axisX.tickCount == 5, "AxisX tick count");
43 verify(axisY.tickCount == 5, "AxisY tick count");
44 verify(axisX.labelFormat == "", "label format");
45
46 // Modify properties
47 axisX.tickCount = 3;
48 verify(axisX.tickCount == 3, "set tick count");
49 }
50
51 function test_functions() {
52 // Set the axis ranges to not "nice" ones...
53 var min = 0.032456456;
54 var max = 10.67845634;
55 axisX.min = min;
56 axisX.max = max;
57 axisY.min = min;
58 axisY.max = max;
59
60 // ...And then apply nice numbers and verify the range was changed
61 axisX.applyNiceNumbers();
62 axisY.applyNiceNumbers();
63 verify(axisX.min != min);
64 verify(axisX.max != max);
65 verify(axisY.min != min);
66 verify(axisY.max != max);
67 }
68
69 function test_signals() {
70 minChangedSpy.clear();
71 maxChangedSpy.clear();
72 axisX.min = 2;
73 compare(minChangedSpy.count, 1, "onMinChanged");
74 compare(maxChangedSpy.count, 0, "onMaxChanged");
75
76 axisX.max = 8;
77 compare(minChangedSpy.count, 1, "onMinChanged");
78 compare(maxChangedSpy.count, 1, "onMaxChanged");
79
80 // restore original values
81 axisX.min = 0;
82 axisX.max = 10;
83 compare(minChangedSpy.count, 2, "onMinChanged");
84 compare(maxChangedSpy.count, 2, "onMaxChanged");
85 }
86 }
87
88 ChartView {
89 id: chartView
90 anchors.fill: parent
91
92 LineSeries {
93 id: lineSeries1
94 axisX: ValueAxis {
95 id: axisX
96 }
97 axisY: ValueAxis {
98 id: axisY
99 }
100 XYPoint { x: -1; y: -1 }
101 XYPoint { x: 0; y: 0 }
102 XYPoint { x: 5; y: 5 }
103 }
104
105 SignalSpy {
106 id: minChangedSpy
107 target: axisX
108 signalName: "minChanged"
109 }
110 SignalSpy {
111 id: maxChangedSpy
112 target: axisX
113 signalName: "maxChanged"
114 }
115 }
116 }
@@ -0,0 +1,260
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 2.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
24
25 Rectangle {
26 width: 400
27 height: 300
28
29 TestCase {
30 id: tc1
31 name: "tst_qml-qtquicktest XY Series 1.3"
32 when: windowShown
33
34 function test_properties() {
35 verify(lineSeries.color != undefined);
36 compare(lineSeries.pointsVisible, false);
37 compare(lineSeries.capStyle, Qt.SquareCap);
38 compare(lineSeries.style, Qt.SolidLine);
39 compare(lineSeries.width, 2.0);
40
41 verify(splineSeries.color != undefined);
42 compare(splineSeries.pointsVisible, false);
43 compare(splineSeries.capStyle, Qt.SquareCap);
44 compare(splineSeries.style, Qt.SolidLine);
45 compare(splineSeries.width, 2.0);
46
47 verify(scatterSeries.color != undefined);
48 verify(scatterSeries.borderColor != undefined);
49 compare(scatterSeries.borderWidth, 2.0);
50 compare(scatterSeries.markerShape, ScatterSeries.MarkerShapeCircle);
51 compare(scatterSeries.markerSize, 15.0);
52
53 verify(areaSeries.color != undefined);
54 verify(areaSeries.borderColor != undefined);
55 compare(areaSeries.borderWidth, 2.0);
56 }
57
58 function test_axes() {
59 // Axis initialization
60 compare(chartView.axisX(), lineSeries.axisX);
61 compare(chartView.axisY(), lineSeries.axisY);
62 compare(lineSeries.axisX, splineSeries.axisX);
63 compare(lineSeries.axisY, splineSeries.axisY);
64 compare(lineSeries.axisX, areaSeries.axisX);
65 compare(lineSeries.axisY, areaSeries.axisY);
66 }
67
68 function test_append() {
69 lineSeriesPointAddedSpy.clear();
70 splineSeriesPointAddedSpy.clear();
71 scatterSeriesPointAddedSpy.clear();
72 var count = append();
73 compare(lineSeries.count, count);
74 compare(splineSeries.count, count);
75 compare(scatterSeries.count, count);
76 compare(lineSeriesPointAddedSpy.count, count);
77 compare(splineSeriesPointAddedSpy.count, count);
78 compare(scatterSeriesPointAddedSpy.count, count);
79 clear();
80 compare(lineSeries.count, 0);
81 compare(splineSeries.count, 0);
82 compare(scatterSeries.count, 0);
83 }
84
85 function test_replace() {
86 var count = append();
87 for (var i = 0; i < count; i++) {
88 lineSeries.replace(lineSeries.at(i).x, lineSeries.at(i).y, i, Math.random());
89 splineSeries.replace(splineSeries.at(i).x, splineSeries.at(i).y, i, Math.random());
90 scatterSeries.replace(scatterSeries.at(i).x, scatterSeries.at(i).y, i, Math.random());
91 }
92 compare(lineSeries.count, count);
93 compare(splineSeries.count, count);
94 compare(scatterSeries.count, count);
95 compare(lineSeriesPointReplacedSpy.count, count);
96 compare(splineSeriesPointReplacedSpy.count, count);
97 compare(scatterSeriesPointReplacedSpy.count, count);
98 clear();
99 }
100
101 function test_insert() {
102 var count = append();
103 lineSeriesPointAddedSpy.clear();
104 splineSeriesPointAddedSpy.clear();
105 scatterSeriesPointAddedSpy.clear();
106 for (var i = 0; i < count; i++) {
107 lineSeries.insert(i * 2, i, Math.random());
108 splineSeries.insert(i * 2, i, Math.random());
109 scatterSeries.insert(i * 2, i, Math.random());
110 }
111 compare(lineSeries.count, count * 2);
112 compare(splineSeries.count, count * 2);
113 compare(scatterSeries.count, count * 2);
114 compare(lineSeriesPointAddedSpy.count, count);
115 compare(splineSeriesPointAddedSpy.count, count);
116 compare(scatterSeriesPointAddedSpy.count, count);
117 clear();
118 }
119
120 function test_remove() {
121 lineSeriesPointRemovedSpy.clear();
122 splineSeriesPointRemovedSpy.clear();
123 scatterSeriesPointRemovedSpy.clear();
124 var count = append();
125 for (var i = 0; i < count; i++) {
126 lineSeries.remove(lineSeries.at(0).x, lineSeries.at(0).y);
127 splineSeries.remove(splineSeries.at(0).x, splineSeries.at(0).y);
128 scatterSeries.remove(scatterSeries.at(0).x, scatterSeries.at(0).y);
129 }
130 compare(lineSeries.count, 0);
131 compare(splineSeries.count, 0);
132 compare(scatterSeries.count, 0);
133 compare(lineSeriesPointRemovedSpy.count, count);
134 compare(splineSeriesPointRemovedSpy.count, count);
135 compare(scatterSeriesPointRemovedSpy.count, count);
136 }
137
138 // Not a test function, called from test functions
139 function append() {
140 var count = 100;
141 chartView.axisX().min = 0;
142 chartView.axisX().max = 100;
143 chartView.axisY().min = 0;
144 chartView.axisY().max = 1;
145
146 for (var i = 0; i < count; i++) {
147 lineSeries.append(i, Math.random());
148 splineSeries.append(i, Math.random());
149 scatterSeries.append(i, Math.random());
150 }
151
152 return count;
153 }
154
155 // Not a test function, called from test functions
156 function clear() {
157 lineSeries.clear();
158 splineSeries.clear();
159 scatterSeries.clear();
160 }
161 }
162
163 ChartView {
164 id: chartView
165 anchors.fill: parent
166
167 LineSeries {
168 id: lineSeries
169 name: "line"
170
171 SignalSpy {
172 id: lineSeriesPointAddedSpy
173 target: lineSeries
174 signalName: "pointAdded"
175 }
176
177 SignalSpy {
178 id: lineSeriesPointReplacedSpy
179 target: lineSeries
180 signalName: "pointReplaced"
181 }
182
183 SignalSpy {
184 id: lineSeriesPointsReplacedSpy
185 target: lineSeries
186 signalName: "pointsReplaced"
187 }
188
189 SignalSpy {
190 id: lineSeriesPointRemovedSpy
191 target: lineSeries
192 signalName: "pointRemoved"
193 }
194 }
195
196 AreaSeries {
197 id: areaSeries
198 name: "area"
199 upperSeries: lineSeries
200 }
201
202 SplineSeries {
203 id: splineSeries
204 name: "spline"
205
206 SignalSpy {
207 id: splineSeriesPointAddedSpy
208 target: splineSeries
209 signalName: "pointAdded"
210 }
211
212 SignalSpy {
213 id: splineSeriesPointReplacedSpy
214 target: splineSeries
215 signalName: "pointReplaced"
216 }
217
218 SignalSpy {
219 id: splineSeriesPointsReplacedSpy
220 target: splineSeries
221 signalName: "pointsReplaced"
222 }
223
224 SignalSpy {
225 id: splineSeriesPointRemovedSpy
226 target: splineSeries
227 signalName: "pointRemoved"
228 }
229 }
230
231 ScatterSeries {
232 id: scatterSeries
233 name: "scatter"
234
235 SignalSpy {
236 id: scatterSeriesPointAddedSpy
237 target: scatterSeries
238 signalName: "pointAdded"
239 }
240
241 SignalSpy {
242 id: scatterSeriesPointReplacedSpy
243 target: scatterSeries
244 signalName: "pointReplaced"
245 }
246
247 SignalSpy {
248 id: scatterSeriesPointsReplacedSpy
249 target: scatterSeries
250 signalName: "pointsReplaced"
251 }
252
253 SignalSpy {
254 id: scatterSeriesPointRemovedSpy
255 target: scatterSeries
256 signalName: "pointRemoved"
257 }
258 }
259 }
260 }
@@ -33,6 +33,7 DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
33 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
33 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
34 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
34 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
35 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
35 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
36 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
36 }
37 }
37
38
38 void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries *series)
39 void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries *series)
@@ -70,6 +71,45 void DeclarativeAreaSeries::setBorderWidth(qreal width)
70 }
71 }
71 }
72 }
72
73
74 QString DeclarativeAreaSeries::brushFilename() const
75 {
76 return m_brushFilename;
77 }
78
79 void DeclarativeAreaSeries::setBrushFilename(const QString &brushFilename)
80 {
81 QImage brushImage(brushFilename);
82 if (QAreaSeries::brush().textureImage() != brushImage) {
83 QBrush brush = QAreaSeries::brush();
84 brush.setTextureImage(brushImage);
85 QAreaSeries::setBrush(brush);
86 m_brushFilename = brushFilename;
87 m_brushImage = brushImage;
88 emit brushFilenameChanged(brushFilename);
89 }
90 }
91
92 void DeclarativeAreaSeries::handleBrushChanged()
93 {
94 // If the texture image of the brush has changed along the brush
95 // the brush file name needs to be cleared.
96 if (!m_brushFilename.isEmpty() && QAreaSeries::brush().textureImage() != m_brushImage) {
97 m_brushFilename.clear();
98 emit brushFilenameChanged(QString(""));
99 }
100 }
101
102 void DeclarativeAreaSeries::setBrush(const QBrush &brush)
103 {
104 QAreaSeries::setBrush(brush);
105 emit brushChanged();
106 }
107
108 QBrush DeclarativeAreaSeries::brush() const
109 {
110 return QAreaSeries::brush();
111 }
112
73 #include "moc_declarativeareaseries.cpp"
113 #include "moc_declarativeareaseries.cpp"
74
114
75 QTCOMMERCIALCHART_END_NAMESPACE
115 QTCOMMERCIALCHART_END_NAMESPACE
@@ -39,6 +39,8 class DeclarativeAreaSeries : public QAreaSeries
39 Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
39 Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
40 Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
40 Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
41 Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
41 Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
42 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4)
43 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4)
42
44
43 public:
45 public:
44 explicit DeclarativeAreaSeries(QObject *parent = 0);
46 explicit DeclarativeAreaSeries(QObject *parent = 0);
@@ -60,6 +62,10 public:
60 Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
62 Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
61 qreal borderWidth() const;
63 qreal borderWidth() const;
62 void setBorderWidth(qreal borderWidth);
64 void setBorderWidth(qreal borderWidth);
65 QString brushFilename() const;
66 void setBrushFilename(const QString &brushFilename);
67 void setBrush(const QBrush &brush);
68 QBrush brush() const;
63
69
64 Q_SIGNALS:
70 Q_SIGNALS:
65 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
71 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
@@ -69,9 +75,18 Q_SIGNALS:
69 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
75 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
70 Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
76 Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
71 Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
77 Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
78 Q_REVISION(4) void brushChanged();
79 Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename);
80
81 private Q_SLOTS:
82 void handleBrushChanged();
72
83
73 public:
84 public:
74 DeclarativeAxes *m_axes;
85 DeclarativeAxes *m_axes;
86
87 private:
88 QString m_brushFilename;
89 QImage m_brushImage;
75 };
90 };
76
91
77 QTCOMMERCIALCHART_END_NAMESPACE
92 QTCOMMERCIALCHART_END_NAMESPACE
@@ -30,6 +30,7 DeclarativeBarSet::DeclarativeBarSet(QObject *parent)
30 {
30 {
31 connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int,int)));
31 connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int,int)));
32 connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int,int)));
32 connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int,int)));
33 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
33 }
34 }
34
35
35 void DeclarativeBarSet::handleCountChanged(int index, int count)
36 void DeclarativeBarSet::handleCountChanged(int index, int count)
@@ -97,6 +98,34 void DeclarativeBarSet::setValues(QVariantList values)
97 }
98 }
98 }
99 }
99
100
101 QString DeclarativeBarSet::brushFilename() const
102 {
103 return m_brushFilename;
104 }
105
106 void DeclarativeBarSet::setBrushFilename(const QString &brushFilename)
107 {
108 QImage brushImage(brushFilename);
109 if (QBarSet::brush().textureImage() != brushImage) {
110 QBrush brush = QBarSet::brush();
111 brush.setTextureImage(brushImage);
112 QBarSet::setBrush(brush);
113 m_brushFilename = brushFilename;
114 m_brushImage = brushImage;
115 emit brushFilenameChanged(brushFilename);
116 }
117 }
118
119 void DeclarativeBarSet::handleBrushChanged()
120 {
121 // If the texture image of the brush has changed along the brush
122 // the brush file name needs to be cleared.
123 if (!m_brushFilename.isEmpty() && QBarSet::brush().textureImage() != m_brushImage) {
124 m_brushFilename.clear();
125 emit brushFilenameChanged(QString(""));
126 }
127 }
128
100 // Declarative bar series ======================================================================================
129 // Declarative bar series ======================================================================================
101 DeclarativeBarSeries::DeclarativeBarSeries(QDECLARATIVE_ITEM *parent) :
130 DeclarativeBarSeries::DeclarativeBarSeries(QDECLARATIVE_ITEM *parent) :
102 QBarSeries(parent),
131 QBarSeries(parent),
@@ -49,6 +49,7 class DeclarativeBarSet : public QBarSet
49 Q_PROPERTY(QVariantList values READ values WRITE setValues)
49 Q_PROPERTY(QVariantList values READ values WRITE setValues)
50 Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
50 Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
51 Q_PROPERTY(int count READ count NOTIFY countChanged)
51 Q_PROPERTY(int count READ count NOTIFY countChanged)
52 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 2)
52
53
53 public:
54 public:
54 explicit DeclarativeBarSet(QObject *parent = 0);
55 explicit DeclarativeBarSet(QObject *parent = 0);
@@ -56,6 +57,8 public:
56 void setValues(QVariantList values);
57 void setValues(QVariantList values);
57 qreal borderWidth() const;
58 qreal borderWidth() const;
58 void setBorderWidth(qreal borderWidth);
59 void setBorderWidth(qreal borderWidth);
60 QString brushFilename() const;
61 void setBrushFilename(const QString &brushFilename);
59
62
60 public: // From QBarSet
63 public: // From QBarSet
61 Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
64 Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
@@ -66,9 +69,15 public: // From QBarSet
66 Q_SIGNALS:
69 Q_SIGNALS:
67 void countChanged(int count);
70 void countChanged(int count);
68 Q_REVISION(1) void borderWidthChanged(qreal width);
71 Q_REVISION(1) void borderWidthChanged(qreal width);
72 Q_REVISION(2) void brushFilenameChanged(const QString &brushFilename);
69
73
70 private Q_SLOTS:
74 private Q_SLOTS:
71 void handleCountChanged(int index, int count);
75 void handleCountChanged(int index, int count);
76 void handleBrushChanged();
77
78 private:
79 QString m_brushFilename;
80 QImage m_brushImage;
72 };
81 };
73
82
74 class DeclarativeBarSeries : public QBarSeries, public QDECLARATIVE_PARSER_STATUS
83 class DeclarativeBarSeries : public QBarSeries, public QDECLARATIVE_PARSER_STATUS
@@ -245,6 +245,7 DeclarativeBoxSet::DeclarativeBoxSet(const QString label, QObject *parent)
245 {
245 {
246 connect(this, SIGNAL(valuesChanged()), this, SIGNAL(changedValues()));
246 connect(this, SIGNAL(valuesChanged()), this, SIGNAL(changedValues()));
247 connect(this, SIGNAL(valueChanged(int)), this, SIGNAL(changedValue(int)));
247 connect(this, SIGNAL(valueChanged(int)), this, SIGNAL(changedValue(int)));
248 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
248 }
249 }
249
250
250 QVariantList DeclarativeBoxSet::values()
251 QVariantList DeclarativeBoxSet::values()
@@ -263,6 +264,34 void DeclarativeBoxSet::setValues(QVariantList values)
263 }
264 }
264 }
265 }
265
266
267 QString DeclarativeBoxSet::brushFilename() const
268 {
269 return m_brushFilename;
270 }
271
272 void DeclarativeBoxSet::setBrushFilename(const QString &brushFilename)
273 {
274 QImage brushImage(brushFilename);
275 if (QBoxSet::brush().textureImage() != brushImage) {
276 QBrush brush = QBoxSet::brush();
277 brush.setTextureImage(brushImage);
278 QBoxSet::setBrush(brush);
279 m_brushFilename = brushFilename;
280 m_brushImage = brushImage;
281 emit brushFilenameChanged(brushFilename);
282 }
283 }
284
285 void DeclarativeBoxSet::handleBrushChanged()
286 {
287 // If the texture image of the brush has changed along the brush
288 // the brush file name needs to be cleared.
289 if (!m_brushFilename.isEmpty() && QBoxSet::brush().textureImage() != m_brushImage) {
290 m_brushFilename.clear();
291 emit brushFilenameChanged(QString(""));
292 }
293 }
294
266 // =====================================================
295 // =====================================================
267
296
268 DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent) :
297 DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent) :
@@ -275,6 +304,7 DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent) :
275 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
304 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
276 connect(this, SIGNAL(hovered(bool, QBoxSet*)), this, SLOT(onHovered(bool, QBoxSet*)));
305 connect(this, SIGNAL(hovered(bool, QBoxSet*)), this, SLOT(onHovered(bool, QBoxSet*)));
277 connect(this, SIGNAL(clicked(QBoxSet*)), this, SLOT(onClicked(QBoxSet*)));
306 connect(this, SIGNAL(clicked(QBoxSet*)), this, SLOT(onClicked(QBoxSet*)));
307 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
278 }
308 }
279
309
280 void DeclarativeBoxPlotSeries::classBegin()
310 void DeclarativeBoxPlotSeries::classBegin()
@@ -334,6 +364,34 void DeclarativeBoxPlotSeries::onClicked(QBoxSet *boxset)
334 emit clicked(qobject_cast<DeclarativeBoxSet *>(boxset));
364 emit clicked(qobject_cast<DeclarativeBoxSet *>(boxset));
335 }
365 }
336
366
367 QString DeclarativeBoxPlotSeries::brushFilename() const
368 {
369 return m_brushFilename;
370 }
371
372 void DeclarativeBoxPlotSeries::setBrushFilename(const QString &brushFilename)
373 {
374 QImage brushImage(brushFilename);
375 if (QBoxPlotSeries::brush().textureImage() != brushImage) {
376 QBrush brush = QBoxPlotSeries::brush();
377 brush.setTextureImage(brushImage);
378 QBoxPlotSeries::setBrush(brush);
379 m_brushFilename = brushFilename;
380 m_brushImage = brushImage;
381 emit brushFilenameChanged(brushFilename);
382 }
383 }
384
385 void DeclarativeBoxPlotSeries::handleBrushChanged()
386 {
387 // If the texture image of the brush has changed along the brush
388 // the brush file name needs to be cleared.
389 if (!m_brushFilename.isEmpty() && QBoxPlotSeries::brush().textureImage() != m_brushImage) {
390 m_brushFilename.clear();
391 emit brushFilenameChanged(QString(""));
392 }
393 }
394
337 #include "moc_declarativeboxplotseries.cpp"
395 #include "moc_declarativeboxplotseries.cpp"
338
396
339 QTCOMMERCIALCHART_END_NAMESPACE
397 QTCOMMERCIALCHART_END_NAMESPACE
@@ -40,6 +40,7 class DeclarativeBoxSet : public QBoxSet
40 Q_PROPERTY(QVariantList values READ values WRITE setValues)
40 Q_PROPERTY(QVariantList values READ values WRITE setValues)
41 Q_PROPERTY(QString label READ label WRITE setLabel)
41 Q_PROPERTY(QString label READ label WRITE setLabel)
42 Q_PROPERTY(int count READ count)
42 Q_PROPERTY(int count READ count)
43 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
43 Q_ENUMS(ValuePositions)
44 Q_ENUMS(ValuePositions)
44
45
45 public: // duplicate from QBoxSet
46 public: // duplicate from QBoxSet
@@ -55,6 +56,8 public:
55 explicit DeclarativeBoxSet(const QString label = "", QObject *parent = 0);
56 explicit DeclarativeBoxSet(const QString label = "", QObject *parent = 0);
56 QVariantList values();
57 QVariantList values();
57 void setValues(QVariantList values);
58 void setValues(QVariantList values);
59 QString brushFilename() const;
60 void setBrushFilename(const QString &brushFilename);
58
61
59 public: // From QBoxSet
62 public: // From QBoxSet
60 Q_INVOKABLE void append(qreal value) { QBoxSet::append(value); }
63 Q_INVOKABLE void append(qreal value) { QBoxSet::append(value); }
@@ -65,6 +68,14 public: // From QBoxSet
65 Q_SIGNALS:
68 Q_SIGNALS:
66 void changedValues();
69 void changedValues();
67 void changedValue(int index);
70 void changedValue(int index);
71 Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
72
73 private Q_SLOTS:
74 void handleBrushChanged();
75
76 private:
77 QString m_brushFilename;
78 QImage m_brushImage;
68 };
79 };
69
80
70 class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QDECLARATIVE_PARSER_STATUS
81 class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QDECLARATIVE_PARSER_STATUS
@@ -84,6 +95,7 class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QDECLARATIVE_PARS
84 #else
95 #else
85 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
96 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
86 #endif
97 #endif
98 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
87 Q_CLASSINFO("DefaultProperty", "seriesChildren")
99 Q_CLASSINFO("DefaultProperty", "seriesChildren")
88
100
89 public:
101 public:
@@ -97,6 +109,8 public:
97 QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
109 QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
98 void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
110 void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
99 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
111 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
112 QString brushFilename() const;
113 void setBrushFilename(const QString &brushFilename);
100
114
101 public:
115 public:
102 Q_INVOKABLE DeclarativeBoxSet *at(int index);
116 Q_INVOKABLE DeclarativeBoxSet *at(int index);
@@ -117,14 +131,22 Q_SIGNALS:
117 void axisYRightChanged(QAbstractAxis *axis);
131 void axisYRightChanged(QAbstractAxis *axis);
118 void clicked(DeclarativeBoxSet *boxset);
132 void clicked(DeclarativeBoxSet *boxset);
119 void hovered(bool status, DeclarativeBoxSet *boxset);
133 void hovered(bool status, DeclarativeBoxSet *boxset);
134 Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
120
135
121 public Q_SLOTS:
136 public Q_SLOTS:
122 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
137 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
123 void onHovered(bool status, QBoxSet *boxset);
138 void onHovered(bool status, QBoxSet *boxset);
124 void onClicked(QBoxSet *boxset);
139 void onClicked(QBoxSet *boxset);
125
140
141 private Q_SLOTS:
142 void handleBrushChanged();
143
126 public:
144 public:
127 DeclarativeAxes *m_axes;
145 DeclarativeAxes *m_axes;
146
147 private:
148 QString m_brushFilename;
149 QImage m_brushImage;
128 };
150 };
129
151
130 QTCOMMERCIALCHART_END_NAMESPACE
152 QTCOMMERCIALCHART_END_NAMESPACE
@@ -25,6 +25,41
25
25
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
27
28 DeclarativePieSlice::DeclarativePieSlice(QObject *parent)
29 : QPieSlice(parent)
30 {
31 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
32 }
33
34 QString DeclarativePieSlice::brushFilename() const
35 {
36 return m_brushFilename;
37 }
38
39 void DeclarativePieSlice::setBrushFilename(const QString &brushFilename)
40 {
41 QImage brushImage(brushFilename);
42 if (QPieSlice::brush().textureImage() != brushImage) {
43 QBrush brush = QPieSlice::brush();
44 brush.setTextureImage(brushImage);
45 QPieSlice::setBrush(brush);
46 m_brushFilename = brushFilename;
47 m_brushImage = brushImage;
48 emit brushFilenameChanged(brushFilename);
49 }
50 }
51
52 void DeclarativePieSlice::handleBrushChanged()
53 {
54 // If the texture image of the brush has changed along the brush
55 // the brush file name needs to be cleared.
56 if (!m_brushFilename.isEmpty() && QPieSlice::brush().textureImage() != m_brushImage) {
57 m_brushFilename.clear();
58 emit brushFilenameChanged(QString(""));
59 }
60 }
61
62 // Declarative pie series =========================================================================
28 DeclarativePieSeries::DeclarativePieSeries(QDECLARATIVE_ITEM *parent) :
63 DeclarativePieSeries::DeclarativePieSeries(QDECLARATIVE_ITEM *parent) :
29 QPieSeries(parent)
64 QPieSeries(parent)
30 {
65 {
@@ -81,13 +116,15 QPieSlice *DeclarativePieSeries::find(QString label)
81 return 0;
116 return 0;
82 }
117 }
83
118
84 QPieSlice *DeclarativePieSeries::append(QString label, qreal value)
119 DeclarativePieSlice *DeclarativePieSeries::append(QString label, qreal value)
85 {
120 {
86 QPieSlice *slice = new QPieSlice(this);
121 DeclarativePieSlice *slice = new DeclarativePieSlice(this);
87 slice->setLabel(label);
122 slice->setLabel(label);
88 slice->setValue(value);
123 slice->setValue(value);
89 QPieSeries::append(slice);
124 if (QPieSeries::append(slice))
90 return slice;
125 return slice;
126 delete slice;
127 return 0;
91 }
128 }
92
129
93 bool DeclarativePieSeries::remove(QPieSlice *slice)
130 bool DeclarativePieSeries::remove(QPieSlice *slice)
@@ -22,6 +22,7
22 #define DECLARATIVEPIESERIES_H
22 #define DECLARATIVEPIESERIES_H
23
23
24 #include "qpieseries.h"
24 #include "qpieseries.h"
25 #include "qpieslice.h"
25 #include "shared_defines.h"
26 #include "shared_defines.h"
26
27
27 #ifdef CHARTS_FOR_QUICK2
28 #ifdef CHARTS_FOR_QUICK2
@@ -33,7 +34,27
33 #endif
34 #endif
34
35
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 class QPieSlice;
37
38 class DeclarativePieSlice : public QPieSlice
39 {
40 Q_OBJECT
41 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged)
42
43 public:
44 explicit DeclarativePieSlice(QObject *parent = 0);
45 QString brushFilename() const;
46 void setBrushFilename(const QString &brushFilename);
47
48 Q_SIGNALS:
49 void brushFilenameChanged(const QString &brushFilename);
50
51 private Q_SLOTS:
52 void handleBrushChanged();
53
54 private:
55 QString m_brushFilename;
56 QImage m_brushImage;
57 };
37
58
38 class DeclarativePieSeries : public QPieSeries, public QDECLARATIVE_PARSER_STATUS
59 class DeclarativePieSeries : public QPieSeries, public QDECLARATIVE_PARSER_STATUS
39 {
60 {
@@ -52,7 +73,7 public:
52 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
73 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
53 Q_INVOKABLE QPieSlice *at(int index);
74 Q_INVOKABLE QPieSlice *at(int index);
54 Q_INVOKABLE QPieSlice *find(QString label);
75 Q_INVOKABLE QPieSlice *find(QString label);
55 Q_INVOKABLE QPieSlice *append(QString label, qreal value);
76 Q_INVOKABLE DeclarativePieSlice *append(QString label, qreal value);
56 Q_INVOKABLE bool remove(QPieSlice *slice);
77 Q_INVOKABLE bool remove(QPieSlice *slice);
57 Q_INVOKABLE void clear();
78 Q_INVOKABLE void clear();
58
79
@@ -34,6 +34,7 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
34 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
34 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
35 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
35 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
36 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
36 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
37 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
37 }
38 }
38
39
39 void DeclarativeScatterSeries::handleCountChanged(int index)
40 void DeclarativeScatterSeries::handleCountChanged(int index)
@@ -69,6 +70,45 void DeclarativeScatterSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPE
69 // Empty implementation, children are parsed in componentComplete
70 // Empty implementation, children are parsed in componentComplete
70 }
71 }
71
72
73 QString DeclarativeScatterSeries::brushFilename() const
74 {
75 return m_brushFilename;
76 }
77
78 void DeclarativeScatterSeries::setBrushFilename(const QString &brushFilename)
79 {
80 QImage brushImage(brushFilename);
81 if (QScatterSeries::brush().textureImage() != brushImage) {
82 QBrush brush = QScatterSeries::brush();
83 brush.setTextureImage(brushImage);
84 QScatterSeries::setBrush(brush);
85 m_brushFilename = brushFilename;
86 m_brushImage = brushImage;
87 emit brushFilenameChanged(brushFilename);
88 }
89 }
90
91 void DeclarativeScatterSeries::setBrush(const QBrush &brush)
92 {
93 QScatterSeries::setBrush(brush);
94 emit brushChanged();
95 }
96
97 QBrush DeclarativeScatterSeries::brush() const
98 {
99 return QScatterSeries::brush();
100 }
101
102 void DeclarativeScatterSeries::handleBrushChanged()
103 {
104 // If the texture image of the brush has changed along the brush
105 // the brush file name needs to be cleared.
106 if (!m_brushFilename.isEmpty() && QScatterSeries::brush().textureImage() != m_brushImage) {
107 m_brushFilename.clear();
108 emit brushFilenameChanged(QString(""));
109 }
110 }
111
72 #include "moc_declarativescatterseries.cpp"
112 #include "moc_declarativescatterseries.cpp"
73
113
74 QTCOMMERCIALCHART_END_NAMESPACE
114 QTCOMMERCIALCHART_END_NAMESPACE
@@ -57,6 +57,8 class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeri
57 #else
57 #else
58 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
58 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
59 #endif
59 #endif
60 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4)
61 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4)
60 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
62 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
61
63
62 public:
64 public:
@@ -77,6 +79,10 public:
77 qreal borderWidth() const;
79 qreal borderWidth() const;
78 void setBorderWidth(qreal borderWidth);
80 void setBorderWidth(qreal borderWidth);
79 QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
81 QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
82 QString brushFilename() const;
83 void setBrushFilename(const QString &brushFilename);
84 void setBrush(const QBrush &brush);
85 QBrush brush() const;
80
86
81 public: // from QDeclarativeParserStatus
87 public: // from QDeclarativeParserStatus
82 void classBegin() { DeclarativeXySeries::classBegin(); }
88 void classBegin() { DeclarativeXySeries::classBegin(); }
@@ -101,13 +107,22 Q_SIGNALS:
101 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
107 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
102 Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
108 Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
103 Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
109 Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
110 Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename);
111 Q_REVISION(4) void brushChanged();
104
112
105 public Q_SLOTS:
113 public Q_SLOTS:
106 static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
114 static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
107 void handleCountChanged(int index);
115 void handleCountChanged(int index);
108
116
117 private Q_SLOTS:
118 void handleBrushChanged();
119
109 public:
120 public:
110 DeclarativeAxes *m_axes;
121 DeclarativeAxes *m_axes;
122
123 private:
124 QString m_brushFilename;
125 QImage m_brushImage;
111 };
126 };
112
127
113 QTCOMMERCIALCHART_END_NAMESPACE
128 QTCOMMERCIALCHART_END_NAMESPACE
@@ -76,6 +76,7 Q_DECLARE_METATYPE(DeclarativeBoxPlotSeries *)
76 Q_DECLARE_METATYPE(DeclarativeBoxSet *)
76 Q_DECLARE_METATYPE(DeclarativeBoxSet *)
77 Q_DECLARE_METATYPE(DeclarativeLineSeries *)
77 Q_DECLARE_METATYPE(DeclarativeLineSeries *)
78 Q_DECLARE_METATYPE(DeclarativePieSeries *)
78 Q_DECLARE_METATYPE(DeclarativePieSeries *)
79 Q_DECLARE_METATYPE(DeclarativePieSlice *)
79 Q_DECLARE_METATYPE(DeclarativeScatterSeries *)
80 Q_DECLARE_METATYPE(DeclarativeScatterSeries *)
80 Q_DECLARE_METATYPE(DeclarativeSplineSeries *)
81 Q_DECLARE_METATYPE(DeclarativeSplineSeries *)
81
82
@@ -238,6 +239,14 public:
238 qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis");
239 qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis");
239 qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries");
240 qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries");
240 qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet");
241 qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet");
242
243 // QtCommercial.Chart 1.4
244 qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 1, 4, "AreaSeries");
245 qmlRegisterType<DeclarativeBarSet, 2>(uri, 1, 4, "BarSet");
246 qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 1, 4, "BoxPlotSeries");
247 qmlRegisterType<DeclarativeBoxSet, 1>(uri, 1, 4, "BoxSet");
248 qmlRegisterType<DeclarativePieSlice>(uri, 1, 4, "PieSlice");
249 qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 1, 4, "ScatterSeries");
241 }
250 }
242 };
251 };
243
252
@@ -2,6 +2,9 import QtQuick.tooling 1.1
2
2
3 // This file describes the plugin-supplied types contained in the library.
3 // This file describes the plugin-supplied types contained in the library.
4 // It is used for QML tooling purposes only.
4 // It is used for QML tooling purposes only.
5 //
6 // This file was auto-generated by:
7 // 'qmlplugindump -nonrelocatable QtCommercial.Chart 1.4'
5
8
6 Module {
9 Module {
7 Component {
10 Component {
@@ -55,9 +58,10 Module {
55 "QtCommercial.Chart/AreaSeries 1.0",
58 "QtCommercial.Chart/AreaSeries 1.0",
56 "QtCommercial.Chart/AreaSeries 1.1",
59 "QtCommercial.Chart/AreaSeries 1.1",
57 "QtCommercial.Chart/AreaSeries 1.2",
60 "QtCommercial.Chart/AreaSeries 1.2",
58 "QtCommercial.Chart/AreaSeries 1.3"
61 "QtCommercial.Chart/AreaSeries 1.3",
62 "QtCommercial.Chart/AreaSeries 1.4"
59 ]
63 ]
60 exportMetaObjectRevisions: [0, 1, 2, 3]
64 exportMetaObjectRevisions: [0, 1, 2, 3, 4]
61 Property { name: "upperSeries"; type: "DeclarativeLineSeries"; isPointer: true }
65 Property { name: "upperSeries"; type: "DeclarativeLineSeries"; isPointer: true }
62 Property { name: "lowerSeries"; type: "DeclarativeLineSeries"; isPointer: true }
66 Property { name: "lowerSeries"; type: "DeclarativeLineSeries"; isPointer: true }
63 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
67 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
@@ -67,6 +71,8 Module {
67 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
71 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
68 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
72 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
69 Property { name: "borderWidth"; revision: 1; type: "double" }
73 Property { name: "borderWidth"; revision: 1; type: "double" }
74 Property { name: "brushFilename"; revision: 4; type: "string" }
75 Property { name: "brush"; revision: 4; type: "QBrush" }
70 Signal {
76 Signal {
71 name: "axisXChanged"
77 name: "axisXChanged"
72 revision: 1
78 revision: 1
@@ -102,12 +108,17 Module {
102 revision: 3
108 revision: 3
103 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
109 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
104 }
110 }
111 Signal { name: "brushChanged"; revision: 4 }
112 Signal {
113 name: "brushFilenameChanged"
114 revision: 4
115 Parameter { name: "brushFilename"; type: "string" }
116 }
105 }
117 }
106 Component {
118 Component {
107 name: "QtCommercialChart::DeclarativeAxes"
119 name: "QtCommercialChart::DeclarativeAxes"
108 prototype: "QObject"
120 prototype: "QObject"
109 exports: ["QtCommercial.Chart/DeclarativeAxes 1.0"]
121 exports: ["QtCommercial.Chart/DeclarativeAxes 1.0"]
110 isCreatable: false
111 exportMetaObjectRevisions: [0]
122 exportMetaObjectRevisions: [0]
112 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
123 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
113 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
124 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
@@ -200,12 +211,14 Module {
200 prototype: "QtCommercialChart::QBarSet"
211 prototype: "QtCommercialChart::QBarSet"
201 exports: [
212 exports: [
202 "QtCommercial.Chart/BarSet 1.0",
213 "QtCommercial.Chart/BarSet 1.0",
203 "QtCommercial.Chart/BarSet 1.1"
214 "QtCommercial.Chart/BarSet 1.1",
215 "QtCommercial.Chart/BarSet 1.4"
204 ]
216 ]
205 exportMetaObjectRevisions: [0, 0]
217 exportMetaObjectRevisions: [0, 0, 2]
206 Property { name: "values"; type: "QVariantList" }
218 Property { name: "values"; type: "QVariantList" }
207 Property { name: "borderWidth"; revision: 1; type: "double" }
219 Property { name: "borderWidth"; revision: 1; type: "double" }
208 Property { name: "count"; type: "int"; isReadonly: true }
220 Property { name: "count"; type: "int"; isReadonly: true }
221 Property { name: "brushFilename"; revision: 2; type: "string" }
209 Signal {
222 Signal {
210 name: "countChanged"
223 name: "countChanged"
211 Parameter { name: "count"; type: "int" }
224 Parameter { name: "count"; type: "int" }
@@ -215,6 +228,11 Module {
215 revision: 1
228 revision: 1
216 Parameter { name: "width"; type: "double" }
229 Parameter { name: "width"; type: "double" }
217 }
230 }
231 Signal {
232 name: "brushFilenameChanged"
233 revision: 2
234 Parameter { name: "brushFilename"; type: "string" }
235 }
218 Method {
236 Method {
219 name: "append"
237 name: "append"
220 Parameter { name: "value"; type: "double" }
238 Parameter { name: "value"; type: "double" }
@@ -243,13 +261,17 Module {
243 name: "QtCommercialChart::DeclarativeBoxPlotSeries"
261 name: "QtCommercialChart::DeclarativeBoxPlotSeries"
244 defaultProperty: "seriesChildren"
262 defaultProperty: "seriesChildren"
245 prototype: "QtCommercialChart::QBoxPlotSeries"
263 prototype: "QtCommercialChart::QBoxPlotSeries"
246 exports: ["QtCommercial.Chart/BoxPlotSeries 1.3"]
264 exports: [
247 exportMetaObjectRevisions: [0]
265 "QtCommercial.Chart/BoxPlotSeries 1.3",
266 "QtCommercial.Chart/BoxPlotSeries 1.4"
267 ]
268 exportMetaObjectRevisions: [0, 1]
248 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
269 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
249 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
270 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
250 Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
271 Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
251 Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
272 Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
252 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
273 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
274 Property { name: "brushFilename"; revision: 1; type: "string" }
253 Signal {
275 Signal {
254 name: "axisXChanged"
276 name: "axisXChanged"
255 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
277 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
@@ -275,6 +297,11 Module {
275 Parameter { name: "status"; type: "bool" }
297 Parameter { name: "status"; type: "bool" }
276 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
298 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
277 }
299 }
300 Signal {
301 name: "brushFilenameChanged"
302 revision: 1
303 Parameter { name: "brushFilename"; type: "string" }
304 }
278 Method {
305 Method {
279 name: "appendSeriesChildren"
306 name: "appendSeriesChildren"
280 Parameter { name: "list"; type: "QDECLARATIVE_LIST_PROPERTY<QObject>"; isPointer: true }
307 Parameter { name: "list"; type: "QDECLARATIVE_LIST_PROPERTY<QObject>"; isPointer: true }
@@ -321,8 +348,11 Module {
321 Component {
348 Component {
322 name: "QtCommercialChart::DeclarativeBoxSet"
349 name: "QtCommercialChart::DeclarativeBoxSet"
323 prototype: "QtCommercialChart::QBoxSet"
350 prototype: "QtCommercialChart::QBoxSet"
324 exports: ["QtCommercial.Chart/BoxSet 1.3"]
351 exports: [
325 exportMetaObjectRevisions: [0]
352 "QtCommercial.Chart/BoxSet 1.3",
353 "QtCommercial.Chart/BoxSet 1.4"
354 ]
355 exportMetaObjectRevisions: [0, 1]
326 Enum {
356 Enum {
327 name: "ValuePositions"
357 name: "ValuePositions"
328 values: {
358 values: {
@@ -336,11 +366,17 Module {
336 Property { name: "values"; type: "QVariantList" }
366 Property { name: "values"; type: "QVariantList" }
337 Property { name: "label"; type: "string" }
367 Property { name: "label"; type: "string" }
338 Property { name: "count"; type: "int"; isReadonly: true }
368 Property { name: "count"; type: "int"; isReadonly: true }
369 Property { name: "brushFilename"; revision: 1; type: "string" }
339 Signal { name: "changedValues" }
370 Signal { name: "changedValues" }
340 Signal {
371 Signal {
341 name: "changedValue"
372 name: "changedValue"
342 Parameter { name: "index"; type: "int" }
373 Parameter { name: "index"; type: "int" }
343 }
374 }
375 Signal {
376 name: "brushFilenameChanged"
377 revision: 1
378 Parameter { name: "brushFilename"; type: "string" }
379 }
344 Method {
380 Method {
345 name: "append"
381 name: "append"
346 Parameter { name: "value"; type: "double" }
382 Parameter { name: "value"; type: "double" }
@@ -912,7 +948,6 Module {
912 name: "QtCommercialChart::DeclarativeMargins"
948 name: "QtCommercialChart::DeclarativeMargins"
913 prototype: "QObject"
949 prototype: "QObject"
914 exports: ["QtCommercial.Chart/Margins 1.1"]
950 exports: ["QtCommercial.Chart/Margins 1.1"]
915 isCreatable: false
916 exportMetaObjectRevisions: [0]
951 exportMetaObjectRevisions: [0]
917 Property { name: "top"; type: "int" }
952 Property { name: "top"; type: "int" }
918 Property { name: "bottom"; type: "int" }
953 Property { name: "bottom"; type: "int" }
@@ -1055,7 +1090,7 Module {
1055 }
1090 }
1056 Method {
1091 Method {
1057 name: "append"
1092 name: "append"
1058 type: "QPieSlice*"
1093 type: "DeclarativePieSlice*"
1059 Parameter { name: "label"; type: "string" }
1094 Parameter { name: "label"; type: "string" }
1060 Parameter { name: "value"; type: "double" }
1095 Parameter { name: "value"; type: "double" }
1061 }
1096 }
@@ -1067,6 +1102,17 Module {
1067 Method { name: "clear" }
1102 Method { name: "clear" }
1068 }
1103 }
1069 Component {
1104 Component {
1105 name: "QtCommercialChart::DeclarativePieSlice"
1106 prototype: "QtCommercialChart::QPieSlice"
1107 exports: ["QtCommercial.Chart/PieSlice 1.4"]
1108 exportMetaObjectRevisions: [0]
1109 Property { name: "brushFilename"; type: "string" }
1110 Signal {
1111 name: "brushFilenameChanged"
1112 Parameter { name: "brushFilename"; type: "string" }
1113 }
1114 }
1115 Component {
1070 name: "QtCommercialChart::DeclarativePolarChart"
1116 name: "QtCommercialChart::DeclarativePolarChart"
1071 defaultProperty: "data"
1117 defaultProperty: "data"
1072 prototype: "QtCommercialChart::DeclarativeChart"
1118 prototype: "QtCommercialChart::DeclarativeChart"
@@ -1081,9 +1127,10 Module {
1081 "QtCommercial.Chart/ScatterSeries 1.0",
1127 "QtCommercial.Chart/ScatterSeries 1.0",
1082 "QtCommercial.Chart/ScatterSeries 1.1",
1128 "QtCommercial.Chart/ScatterSeries 1.1",
1083 "QtCommercial.Chart/ScatterSeries 1.2",
1129 "QtCommercial.Chart/ScatterSeries 1.2",
1084 "QtCommercial.Chart/ScatterSeries 1.3"
1130 "QtCommercial.Chart/ScatterSeries 1.3",
1131 "QtCommercial.Chart/ScatterSeries 1.4"
1085 ]
1132 ]
1086 exportMetaObjectRevisions: [0, 1, 2, 3]
1133 exportMetaObjectRevisions: [0, 1, 2, 3, 4]
1087 Property { name: "count"; type: "int"; isReadonly: true }
1134 Property { name: "count"; type: "int"; isReadonly: true }
1088 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1135 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1089 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1136 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
@@ -1093,6 +1140,8 Module {
1093 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1140 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1094 Property { name: "borderWidth"; revision: 1; type: "double" }
1141 Property { name: "borderWidth"; revision: 1; type: "double" }
1095 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
1142 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
1143 Property { name: "brushFilename"; revision: 4; type: "string" }
1144 Property { name: "brush"; revision: 4; type: "QBrush" }
1096 Signal {
1145 Signal {
1097 name: "countChanged"
1146 name: "countChanged"
1098 Parameter { name: "count"; type: "int" }
1147 Parameter { name: "count"; type: "int" }
@@ -1132,6 +1181,12 Module {
1132 revision: 3
1181 revision: 3
1133 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1182 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1134 }
1183 }
1184 Signal {
1185 name: "brushFilenameChanged"
1186 revision: 4
1187 Parameter { name: "brushFilename"; type: "string" }
1188 }
1189 Signal { name: "brushChanged"; revision: 4 }
1135 Method {
1190 Method {
1136 name: "appendDeclarativeChildren"
1191 name: "appendDeclarativeChildren"
1137 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1192 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
@@ -1387,7 +1442,6 Module {
1387 name: "QtCommercialChart::QAbstractAxis"
1442 name: "QtCommercialChart::QAbstractAxis"
1388 prototype: "QObject"
1443 prototype: "QObject"
1389 exports: ["QtCommercial.Chart/AbstractAxis 1.0"]
1444 exports: ["QtCommercial.Chart/AbstractAxis 1.0"]
1390 isCreatable: false
1391 exportMetaObjectRevisions: [0]
1445 exportMetaObjectRevisions: [0]
1392 Property { name: "visible"; type: "bool" }
1446 Property { name: "visible"; type: "bool" }
1393 Property { name: "lineVisible"; type: "bool" }
1447 Property { name: "lineVisible"; type: "bool" }
@@ -1506,7 +1560,6 Module {
1506 name: "QtCommercialChart::QAbstractBarSeries"
1560 name: "QtCommercialChart::QAbstractBarSeries"
1507 prototype: "QtCommercialChart::QAbstractSeries"
1561 prototype: "QtCommercialChart::QAbstractSeries"
1508 exports: ["QtCommercial.Chart/AbstractBarSeries 1.0"]
1562 exports: ["QtCommercial.Chart/AbstractBarSeries 1.0"]
1509 isCreatable: false
1510 exportMetaObjectRevisions: [0]
1563 exportMetaObjectRevisions: [0]
1511 Property { name: "barWidth"; type: "double" }
1564 Property { name: "barWidth"; type: "double" }
1512 Property { name: "count"; type: "int"; isReadonly: true }
1565 Property { name: "count"; type: "int"; isReadonly: true }
@@ -1540,7 +1593,6 Module {
1540 name: "QtCommercialChart::QAbstractSeries"
1593 name: "QtCommercialChart::QAbstractSeries"
1541 prototype: "QObject"
1594 prototype: "QObject"
1542 exports: ["QtCommercial.Chart/AbstractSeries 1.0"]
1595 exports: ["QtCommercial.Chart/AbstractSeries 1.0"]
1543 isCreatable: false
1544 exportMetaObjectRevisions: [0]
1596 exportMetaObjectRevisions: [0]
1545 Enum {
1597 Enum {
1546 name: "SeriesType"
1598 name: "SeriesType"
@@ -1620,7 +1672,6 Module {
1620 name: "QtCommercialChart::QBarModelMapper"
1672 name: "QtCommercialChart::QBarModelMapper"
1621 prototype: "QObject"
1673 prototype: "QObject"
1622 exports: ["QtCommercial.Chart/BarModelMapper 1.0"]
1674 exports: ["QtCommercial.Chart/BarModelMapper 1.0"]
1623 isCreatable: false
1624 exportMetaObjectRevisions: [0]
1675 exportMetaObjectRevisions: [0]
1625 }
1676 }
1626 Component {
1677 Component {
@@ -1631,7 +1682,6 Module {
1631 name: "QtCommercialChart::QBarSet"
1682 name: "QtCommercialChart::QBarSet"
1632 prototype: "QObject"
1683 prototype: "QObject"
1633 exports: ["QtCommercial.Chart/BarSetBase 1.0"]
1684 exports: ["QtCommercial.Chart/BarSetBase 1.0"]
1634 isCreatable: false
1635 exportMetaObjectRevisions: [0]
1685 exportMetaObjectRevisions: [0]
1636 Property { name: "label"; type: "string" }
1686 Property { name: "label"; type: "string" }
1637 Property { name: "pen"; type: "QPen" }
1687 Property { name: "pen"; type: "QPen" }
@@ -1823,7 +1873,6 Module {
1823 defaultProperty: "children"
1873 defaultProperty: "children"
1824 prototype: "QGraphicsWidget"
1874 prototype: "QGraphicsWidget"
1825 exports: ["QtCommercial.Chart/Legend 1.0"]
1875 exports: ["QtCommercial.Chart/Legend 1.0"]
1826 isCreatable: false
1827 exportMetaObjectRevisions: [0]
1876 exportMetaObjectRevisions: [0]
1828 Property { name: "alignment"; type: "Qt::Alignment" }
1877 Property { name: "alignment"; type: "Qt::Alignment" }
1829 Property { name: "backgroundVisible"; type: "bool" }
1878 Property { name: "backgroundVisible"; type: "bool" }
@@ -1897,14 +1946,12 Module {
1897 name: "QtCommercialChart::QPieModelMapper"
1946 name: "QtCommercialChart::QPieModelMapper"
1898 prototype: "QObject"
1947 prototype: "QObject"
1899 exports: ["QtCommercial.Chart/PieModelMapper 1.0"]
1948 exports: ["QtCommercial.Chart/PieModelMapper 1.0"]
1900 isCreatable: false
1901 exportMetaObjectRevisions: [0]
1949 exportMetaObjectRevisions: [0]
1902 }
1950 }
1903 Component {
1951 Component {
1904 name: "QtCommercialChart::QPieSeries"
1952 name: "QtCommercialChart::QPieSeries"
1905 prototype: "QtCommercialChart::QAbstractSeries"
1953 prototype: "QtCommercialChart::QAbstractSeries"
1906 exports: ["QtCommercial.Chart/QPieSeries 1.0"]
1954 exports: ["QtCommercial.Chart/QPieSeries 1.0"]
1907 isCreatable: false
1908 exportMetaObjectRevisions: [0]
1955 exportMetaObjectRevisions: [0]
1909 Property { name: "horizontalPosition"; type: "double" }
1956 Property { name: "horizontalPosition"; type: "double" }
1910 Property { name: "verticalPosition"; type: "double" }
1957 Property { name: "verticalPosition"; type: "double" }
@@ -1984,6 +2031,7 Module {
1984 Property { name: "borderColor"; type: "QColor" }
2031 Property { name: "borderColor"; type: "QColor" }
1985 Property { name: "markerShape"; type: "MarkerShape" }
2032 Property { name: "markerShape"; type: "MarkerShape" }
1986 Property { name: "markerSize"; type: "double" }
2033 Property { name: "markerSize"; type: "double" }
2034 Property { name: "brush"; type: "QBrush" }
1987 Signal {
2035 Signal {
1988 name: "colorChanged"
2036 name: "colorChanged"
1989 Parameter { name: "color"; type: "QColor" }
2037 Parameter { name: "color"; type: "QColor" }
@@ -2083,14 +2131,12 Module {
2083 name: "QtCommercialChart::QXYModelMapper"
2131 name: "QtCommercialChart::QXYModelMapper"
2084 prototype: "QObject"
2132 prototype: "QObject"
2085 exports: ["QtCommercial.Chart/XYModelMapper 1.0"]
2133 exports: ["QtCommercial.Chart/XYModelMapper 1.0"]
2086 isCreatable: false
2087 exportMetaObjectRevisions: [0]
2134 exportMetaObjectRevisions: [0]
2088 }
2135 }
2089 Component {
2136 Component {
2090 name: "QtCommercialChart::QXYSeries"
2137 name: "QtCommercialChart::QXYSeries"
2091 prototype: "QtCommercialChart::QAbstractSeries"
2138 prototype: "QtCommercialChart::QAbstractSeries"
2092 exports: ["QtCommercial.Chart/XYSeries 1.0"]
2139 exports: ["QtCommercial.Chart/XYSeries 1.0"]
2093 isCreatable: false
2094 exportMetaObjectRevisions: [0]
2140 exportMetaObjectRevisions: [0]
2095 Property { name: "pointsVisible"; type: "bool" }
2141 Property { name: "pointsVisible"; type: "bool" }
2096 Property { name: "color"; type: "QColor" }
2142 Property { name: "color"; type: "QColor" }
@@ -121,6 +121,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
121 */
121 */
122
122
123 /*!
123 /*!
124 \qmlproperty QString AreaSeries::brushFilename
125 The name of the file used as a brush image for the series.
126 */
127
128 /*!
124 \fn void QAreaSeries::colorChanged(QColor color)
129 \fn void QAreaSeries::colorChanged(QColor color)
125 \brief Signal is emitted when the fill (brush) color has changed to \a color.
130 \brief Signal is emitted when the fill (brush) color has changed to \a color.
126 */
131 */
@@ -75,6 +75,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
75 */
75 */
76
76
77 /*!
77 /*!
78 \qmlproperty QString BarSet::brushFilename
79 The name of the file used as a brush for the set.
80 */
81
82 /*!
78 \property QBarSet::labelBrush
83 \property QBarSet::labelBrush
79 \brief Defines the brush used by the bar set's label.
84 \brief Defines the brush used by the bar set's label.
80 */
85 */
@@ -87,6 +87,12 QTCOMMERCIALCHART_BEGIN_NAMESPACE
87 \property QBoxPlotSeries::brush
87 \property QBoxPlotSeries::brush
88 \brief This property configures the brush of the box-and-whiskers items.
88 \brief This property configures the brush of the box-and-whiskers items.
89 */
89 */
90
91 /*!
92 \qmlproperty QString BoxPlotSeries::brushFilename
93 The name of the file used as a brush for the series.
94 */
95
90 /*!
96 /*!
91 \fn void QBoxPlotSeries::boxOutlineVisibilityChanged()
97 \fn void QBoxPlotSeries::boxOutlineVisibilityChanged()
92 Signal is emitted when the middle box outline visibility is changed.
98 Signal is emitted when the middle box outline visibility is changed.
@@ -56,6 +56,12 QTCOMMERCIALCHART_BEGIN_NAMESPACE
56 \property QBoxSet::brush
56 \property QBoxSet::brush
57 \brief Defines the brush used by the box-and-whiskers set.
57 \brief Defines the brush used by the box-and-whiskers set.
58 */
58 */
59
60 /*!
61 \qmlproperty QString BoxSet::brushFilename
62 The name of the file used as a brush for the box-and-whiskers set.
63 */
64
59 /*!
65 /*!
60 \fn void QBoxSet::clicked()
66 \fn void QBoxSet::clicked()
61 The signal is emitted if the user clicks with a mouse on top of box-and-whisker item.
67 The signal is emitted if the user clicks with a mouse on top of box-and-whisker item.
@@ -211,6 +211,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
211 */
211 */
212
212
213 /*!
213 /*!
214 \qmlproperty QString PieSlice::brushFilename
215 The name of the file used as a brush for the slice.
216 */
217
218 /*!
214 \property QPieSlice::color
219 \property QPieSlice::color
215 Fill (brush) color of the slice.
220 Fill (brush) color of the slice.
216 This is a convenience property for modifying the slice brush.
221 This is a convenience property for modifying the slice brush.
@@ -73,6 +73,11
73 */
73 */
74
74
75 /*!
75 /*!
76 \property QScatterSeries::brush
77 Brush used to draw the series.
78 */
79
80 /*!
76 \property QScatterSeries::color
81 \property QScatterSeries::color
77 Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
82 Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
78 \sa QScatterSeries::brush()
83 \sa QScatterSeries::brush()
@@ -114,6 +119,11
114 */
119 */
115
120
116 /*!
121 /*!
122 \qmlproperty QString ScatterSeries::brushFilename
123 The name of the file used as a brush for the series.
124 */
125
126 /*!
117 \fn void QScatterSeries::colorChanged(QColor color)
127 \fn void QScatterSeries::colorChanged(QColor color)
118 Signal is emitted when the fill (brush) color has changed to \a color.
128 Signal is emitted when the fill (brush) color has changed to \a color.
119 */
129 */
@@ -192,6 +202,15 void QScatterSeries::setBrush(const QBrush &brush)
192 }
202 }
193 }
203 }
194
204
205 QBrush QScatterSeries::brush() const
206 {
207 Q_D(const QScatterSeries);
208 if (d->m_brush == QChartPrivate::defaultBrush())
209 return QBrush();
210 else
211 return d->m_brush;
212 }
213
195 void QScatterSeries::setColor(const QColor &color)
214 void QScatterSeries::setColor(const QColor &color)
196 {
215 {
197 QBrush b = brush();
216 QBrush b = brush();
@@ -35,6 +35,7 class QTCOMMERCIALCHART_EXPORT QScatterSeries : public QXYSeries
35 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
35 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
36 Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape)
36 Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape)
37 Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize)
37 Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize)
38 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
38 Q_ENUMS(MarkerShape)
39 Q_ENUMS(MarkerShape)
39
40
40 public:
41 public:
@@ -49,6 +50,7 public:
49 QAbstractSeries::SeriesType type() const;
50 QAbstractSeries::SeriesType type() const;
50 void setPen(const QPen &pen);
51 void setPen(const QPen &pen);
51 void setBrush(const QBrush &brush);
52 void setBrush(const QBrush &brush);
53 QBrush brush() const;
52 void setColor(const QColor &color);
54 void setColor(const QColor &color);
53 QColor color() const;
55 QColor color() const;
54 void setBorderColor(const QColor &color);
56 void setBorderColor(const QColor &color);
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -36,6 +36,11 Rectangle {
36 compare(barSeries.labelsVisible, false);
36 compare(barSeries.labelsVisible, false);
37 }
37 }
38
38
39 function test_setproperties() {
40 var set = barSeries.append("property", [1, 2, 3])
41 compare(set.brushFilename, "");
42 }
43
39 function test_axes() {
44 function test_axes() {
40 verify(chartView.axisX() == barSeries.axisX);
45 verify(chartView.axisX() == barSeries.axisX);
41 verify(chartView.axisY() == barSeries.axisY);
46 verify(chartView.axisY() == barSeries.axisY);
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -33,12 +33,14 Rectangle {
33
33
34 function test_properties() {
34 function test_properties() {
35 compare(boxPlotSeries.boxWidth, 0.5);
35 compare(boxPlotSeries.boxWidth, 0.5);
36 compare(boxPlotSeries.brushFilename, "");
36 }
37 }
37
38
38 function test_setproperties() {
39 function test_setproperties() {
39 var set = boxPlotSeries.append("boxplot", [1, 2, 5, 6, 8]);
40 var set = boxPlotSeries.append("boxplot", [1, 2, 5, 6, 8]);
40 compare(set.label, "boxplot");
41 compare(set.label, "boxplot");
41 compare(set.count, 5);
42 compare(set.count, 5);
43 compare(set.brushFilename, "");
42 }
44 }
43
45
44 function test_append() {
46 function test_append() {
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -58,6 +58,7 Rectangle {
58 compare(slice.percentage, 1.0);
58 compare(slice.percentage, 1.0);
59 compare(slice.startAngle, 0.0);
59 compare(slice.startAngle, 0.0);
60 compare(slice.value, 10.0);
60 compare(slice.value, 10.0);
61 compare(slice.brushFilename, "");
61 }
62 }
62
63
63 function test_append() {
64 function test_append() {
@@ -88,12 +89,15 Rectangle {
88 compare(pieSeries.count, 0);
89 compare(pieSeries.count, 0);
89 }
90 }
90
91
91 function test_find() {
92 function test_find_and_at() {
92 var count = 50;
93 var count = 50;
93 for (var i = 0; i < count; i++)
94 for (var i = 0; i < count; i++)
94 pieSeries.append("slice" + i, Math.random());
95 pieSeries.append("slice" + i, Math.random());
95 for (var j = 0; j < count; j++)
96 for (var j = 0; j < count; j++) {
96 compare(pieSeries.find("slice" + j).label, "slice" + j);
97 compare(pieSeries.find("slice" + j).label, "slice" + j);
98 compare(pieSeries.find("slice" + j).brushFilename, "");
99 }
100 compare(pieSeries.at(3).brushFilename,"");
97 pieSeries.clear();
101 pieSeries.clear();
98 }
102 }
99 }
103 }
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -20,7 +20,7
20
20
21 import QtQuick 2.0
21 import QtQuick 2.0
22 import QtTest 1.0
22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24
24
25 Rectangle {
25 Rectangle {
26 width: 400
26 width: 400
@@ -49,10 +49,12 Rectangle {
49 compare(scatterSeries.borderWidth, 2.0);
49 compare(scatterSeries.borderWidth, 2.0);
50 compare(scatterSeries.markerShape, ScatterSeries.MarkerShapeCircle);
50 compare(scatterSeries.markerShape, ScatterSeries.MarkerShapeCircle);
51 compare(scatterSeries.markerSize, 15.0);
51 compare(scatterSeries.markerSize, 15.0);
52 compare(scatterSeries.brushFilename, "");
52
53
53 verify(areaSeries.color != undefined);
54 verify(areaSeries.color != undefined);
54 verify(areaSeries.borderColor != undefined);
55 verify(areaSeries.borderColor != undefined);
55 compare(areaSeries.borderWidth, 2.0);
56 compare(areaSeries.borderWidth, 2.0);
57 compare(areaSeries.brushFilename, "");
56 }
58 }
57
59
58 function test_axes() {
60 function test_axes() {
General Comments 0
You need to be logged in to leave comments. Login now