##// 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 }
@@ -1,75 +1,115
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "declarativeareaseries.h"
22 22 #include "declarativelineseries.h"
23 23
24 24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25 25
26 26 DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
27 27 QAreaSeries(parent),
28 28 m_axes(new DeclarativeAxes(this))
29 29 {
30 30 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
31 31 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
32 32 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
33 33 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
34 34 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
35 35 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
36 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
36 37 }
37 38
38 39 void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries *series)
39 40 {
40 41 QAreaSeries::setUpperSeries(series);
41 42 }
42 43
43 44 DeclarativeLineSeries *DeclarativeAreaSeries::upperSeries() const
44 45 {
45 46 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries());
46 47 }
47 48
48 49 void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries *series)
49 50 {
50 51 QAreaSeries::setLowerSeries(series);
51 52 }
52 53
53 54 DeclarativeLineSeries *DeclarativeAreaSeries::lowerSeries() const
54 55 {
55 56 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
56 57 }
57 58
58 59 qreal DeclarativeAreaSeries::borderWidth() const
59 60 {
60 61 return pen().widthF();
61 62 }
62 63
63 64 void DeclarativeAreaSeries::setBorderWidth(qreal width)
64 65 {
65 66 if (width != pen().widthF()) {
66 67 QPen p = pen();
67 68 p.setWidthF(width);
68 69 setPen(p);
69 70 emit borderWidthChanged(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 113 #include "moc_declarativeareaseries.cpp"
74 114
75 115 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,79 +1,94
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef DECLARATIVEAREASERIES_H
22 22 #define DECLARATIVEAREASERIES_H
23 23
24 24 #include "qareaseries.h"
25 25 #include "declarativeaxes.h"
26 26
27 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28 class DeclarativeLineSeries;
29 29
30 30 class DeclarativeAreaSeries : public QAreaSeries
31 31 {
32 32 Q_OBJECT
33 33 Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
34 34 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
35 35 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
36 36 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
37 37 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
38 38 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
39 39 Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
40 40 Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
41 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 45 public:
44 46 explicit DeclarativeAreaSeries(QObject *parent = 0);
45 47 void setUpperSeries(DeclarativeLineSeries *series);
46 48 DeclarativeLineSeries *upperSeries() const;
47 49 void setLowerSeries(DeclarativeLineSeries *series);
48 50 DeclarativeLineSeries *lowerSeries() const;
49 51 QAbstractAxis *axisX() { return m_axes->axisX(); }
50 52 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
51 53 QAbstractAxis *axisY() { return m_axes->axisY(); }
52 54 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
53 55 Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
54 56 Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
55 57 Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
56 58 Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
57 59 Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
58 60 Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
59 61 Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
60 62 Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
61 63 qreal borderWidth() const;
62 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 70 Q_SIGNALS:
65 71 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
66 72 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
67 73 Q_REVISION(1) void borderWidthChanged(qreal width);
68 74 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
69 75 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
70 76 Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
71 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 84 public:
74 85 DeclarativeAxes *m_axes;
86
87 private:
88 QString m_brushFilename;
89 QImage m_brushImage;
75 90 };
76 91
77 92 QTCOMMERCIALCHART_END_NAMESPACE
78 93
79 94 #endif // DECLARATIVEAREASERIES_H
@@ -1,480 +1,509
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "declarativebarseries.h"
22 22 #include "qbarset.h"
23 23 #include "qvbarmodelmapper.h"
24 24 #include "qhbarmodelmapper.h"
25 25
26 26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 27
28 28 DeclarativeBarSet::DeclarativeBarSet(QObject *parent)
29 29 : QBarSet("", parent)
30 30 {
31 31 connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int,int)));
32 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 36 void DeclarativeBarSet::handleCountChanged(int index, int count)
36 37 {
37 38 Q_UNUSED(index)
38 39 Q_UNUSED(count)
39 40 emit countChanged(QBarSet::count());
40 41 }
41 42
42 43 qreal DeclarativeBarSet::borderWidth() const
43 44 {
44 45 return pen().widthF();
45 46 }
46 47
47 48 void DeclarativeBarSet::setBorderWidth(qreal width)
48 49 {
49 50 if (width != pen().widthF()) {
50 51 QPen p = pen();
51 52 p.setWidthF(width);
52 53 setPen(p);
53 54 emit borderWidthChanged(width);
54 55 }
55 56 }
56 57
57 58 QVariantList DeclarativeBarSet::values()
58 59 {
59 60 QVariantList values;
60 61 for (int i(0); i < count(); i++)
61 62 values.append(QVariant(QBarSet::at(i)));
62 63 return values;
63 64 }
64 65
65 66 void DeclarativeBarSet::setValues(QVariantList values)
66 67 {
67 68 while (count())
68 69 remove(count() - 1);
69 70
70 71 if (values.at(0).canConvert(QVariant::Point)) {
71 72 // Create list of values for appending if the first item is Qt.point
72 73 int maxValue = 0;
73 74 for (int i = 0; i < values.count(); i++) {
74 75 if (values.at(i).canConvert(QVariant::Point) &&
75 76 values.at(i).toPoint().x() > maxValue) {
76 77 maxValue = values.at(i).toPoint().x();
77 78 }
78 79 }
79 80
80 81 QVector<int> indexValueList;
81 82 indexValueList.resize(maxValue + 1);
82 83
83 84 for (int i = 0; i < values.count(); i++) {
84 85 if (values.at(i).canConvert(QVariant::Point)) {
85 86 indexValueList.replace(values.at(i).toPoint().x(), values.at(i).toPoint().y());
86 87 }
87 88 }
88 89
89 90 for (int i = 0; i < indexValueList.count(); i++)
90 91 QBarSet::append(indexValueList.at(i));
91 92
92 93 } else {
93 94 for (int i(0); i < values.count(); i++) {
94 95 if (values.at(i).canConvert(QVariant::Double))
95 96 QBarSet::append(values[i].toDouble());
96 97 }
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 129 // Declarative bar series ======================================================================================
101 130 DeclarativeBarSeries::DeclarativeBarSeries(QDECLARATIVE_ITEM *parent) :
102 131 QBarSeries(parent),
103 132 m_axes(new DeclarativeAxes(this))
104 133 {
105 134 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
106 135 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
107 136 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
108 137 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
109 138 }
110 139
111 140 void DeclarativeBarSeries::classBegin()
112 141 {
113 142 }
114 143
115 144 void DeclarativeBarSeries::componentComplete()
116 145 {
117 146 foreach (QObject *child, children()) {
118 147 if (qobject_cast<DeclarativeBarSet *>(child)) {
119 148 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
120 149 } else if (qobject_cast<QVBarModelMapper *>(child)) {
121 150 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
122 151 mapper->setSeries(this);
123 152 } else if (qobject_cast<QHBarModelMapper *>(child)) {
124 153 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
125 154 mapper->setSeries(this);
126 155 }
127 156 }
128 157 }
129 158
130 159 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeBarSeries::seriesChildren()
131 160 {
132 161 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
133 162 }
134 163
135 164 void DeclarativeBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
136 165 {
137 166 // Empty implementation; the children are parsed in componentComplete instead
138 167 Q_UNUSED(list);
139 168 Q_UNUSED(element);
140 169 }
141 170
142 171 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
143 172 {
144 173 QList<QBarSet *> setList = barSets();
145 174 if (index >= 0 && index < setList.count())
146 175 return qobject_cast<DeclarativeBarSet *>(setList[index]);
147 176
148 177 return 0;
149 178 }
150 179
151 180 DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
152 181 {
153 182 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
154 183 barset->setLabel(label);
155 184 barset->setValues(values);
156 185 if (QBarSeries::insert(index, barset))
157 186 return barset;
158 187 delete barset;
159 188 return 0;
160 189 }
161 190
162 191 // Declarative stacked bar series ==============================================================================
163 192 DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDECLARATIVE_ITEM *parent) :
164 193 QStackedBarSeries(parent),
165 194 m_axes(0)
166 195 {
167 196 m_axes = new DeclarativeAxes(this);
168 197 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
169 198 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
170 199 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
171 200 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
172 201 }
173 202
174 203 void DeclarativeStackedBarSeries::classBegin()
175 204 {
176 205 }
177 206
178 207 void DeclarativeStackedBarSeries::componentComplete()
179 208 {
180 209 foreach (QObject *child, children()) {
181 210 if (qobject_cast<DeclarativeBarSet *>(child)) {
182 211 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
183 212 } else if (qobject_cast<QVBarModelMapper *>(child)) {
184 213 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
185 214 mapper->setSeries(this);
186 215 } else if (qobject_cast<QHBarModelMapper *>(child)) {
187 216 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
188 217 mapper->setSeries(this);
189 218 }
190 219 }
191 220 }
192 221
193 222
194 223 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeStackedBarSeries::seriesChildren()
195 224 {
196 225 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
197 226 }
198 227
199 228 void DeclarativeStackedBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
200 229 {
201 230 // Empty implementation; the children are parsed in componentComplete instead
202 231 Q_UNUSED(list);
203 232 Q_UNUSED(element);
204 233 }
205 234
206 235 DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index)
207 236 {
208 237 QList<QBarSet *> setList = barSets();
209 238 if (index >= 0 && index < setList.count())
210 239 return qobject_cast<DeclarativeBarSet *>(setList[index]);
211 240
212 241 return 0;
213 242 }
214 243
215 244 DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label, QVariantList values)
216 245 {
217 246 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
218 247 barset->setLabel(label);
219 248 barset->setValues(values);
220 249 if (QStackedBarSeries::insert(index, barset))
221 250 return barset;
222 251 delete barset;
223 252 return 0;
224 253 }
225 254
226 255 // Declarative percent bar series ==============================================================================
227 256 DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDECLARATIVE_ITEM *parent) :
228 257 QPercentBarSeries(parent),
229 258 m_axes(0)
230 259 {
231 260 m_axes = new DeclarativeAxes(this);
232 261 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
233 262 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
234 263 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
235 264 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
236 265 }
237 266
238 267 void DeclarativePercentBarSeries::classBegin()
239 268 {
240 269 }
241 270
242 271 void DeclarativePercentBarSeries::componentComplete()
243 272 {
244 273 foreach (QObject *child, children()) {
245 274 if (qobject_cast<DeclarativeBarSet *>(child)) {
246 275 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
247 276 } else if (qobject_cast<QVBarModelMapper *>(child)) {
248 277 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
249 278 mapper->setSeries(this);
250 279 } else if (qobject_cast<QHBarModelMapper *>(child)) {
251 280 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
252 281 mapper->setSeries(this);
253 282 }
254 283 }
255 284 }
256 285
257 286 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativePercentBarSeries::seriesChildren()
258 287 {
259 288 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
260 289 }
261 290
262 291 void DeclarativePercentBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
263 292 {
264 293 // Empty implementation; the children are parsed in componentComplete instead
265 294 Q_UNUSED(list);
266 295 Q_UNUSED(element);
267 296 }
268 297
269 298 DeclarativeBarSet *DeclarativePercentBarSeries::at(int index)
270 299 {
271 300 QList<QBarSet *> setList = barSets();
272 301 if (index >= 0 && index < setList.count())
273 302 return qobject_cast<DeclarativeBarSet *>(setList[index]);
274 303
275 304 return 0;
276 305 }
277 306
278 307 DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label, QVariantList values)
279 308 {
280 309 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
281 310 barset->setLabel(label);
282 311 barset->setValues(values);
283 312 if (QPercentBarSeries::insert(index, barset))
284 313 return barset;
285 314 delete barset;
286 315 return 0;
287 316 }
288 317
289 318 // Declarative horizontal bar series ===========================================================================
290 319 DeclarativeHorizontalBarSeries::DeclarativeHorizontalBarSeries(QDECLARATIVE_ITEM *parent) :
291 320 QHorizontalBarSeries(parent),
292 321 m_axes(0)
293 322 {
294 323 m_axes = new DeclarativeAxes(this);
295 324 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
296 325 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
297 326 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
298 327 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
299 328 }
300 329
301 330 void DeclarativeHorizontalBarSeries::classBegin()
302 331 {
303 332 }
304 333
305 334 void DeclarativeHorizontalBarSeries::componentComplete()
306 335 {
307 336 foreach (QObject *child, children()) {
308 337 if (qobject_cast<DeclarativeBarSet *>(child)) {
309 338 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
310 339 } else if (qobject_cast<QVBarModelMapper *>(child)) {
311 340 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
312 341 mapper->setSeries(this);
313 342 } else if (qobject_cast<QHBarModelMapper *>(child)) {
314 343 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
315 344 mapper->setSeries(this);
316 345 }
317 346 }
318 347 }
319 348
320 349 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalBarSeries::seriesChildren()
321 350 {
322 351 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
323 352 }
324 353
325 354 void DeclarativeHorizontalBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
326 355 {
327 356 // Empty implementation; the children are parsed in componentComplete instead
328 357 Q_UNUSED(list);
329 358 Q_UNUSED(element);
330 359 }
331 360
332 361 DeclarativeBarSet *DeclarativeHorizontalBarSeries::at(int index)
333 362 {
334 363 QList<QBarSet *> setList = barSets();
335 364 if (index >= 0 && index < setList.count())
336 365 return qobject_cast<DeclarativeBarSet *>(setList[index]);
337 366
338 367 return 0;
339 368 }
340 369
341 370 DeclarativeBarSet *DeclarativeHorizontalBarSeries::insert(int index, QString label, QVariantList values)
342 371 {
343 372 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
344 373 barset->setLabel(label);
345 374 barset->setValues(values);
346 375 if (QHorizontalBarSeries::insert(index, barset))
347 376 return barset;
348 377 delete barset;
349 378 return 0;
350 379 }
351 380
352 381 // Declarative horizontal stacked bar series ===================================================================
353 382 DeclarativeHorizontalStackedBarSeries::DeclarativeHorizontalStackedBarSeries(QDECLARATIVE_ITEM *parent) :
354 383 QHorizontalStackedBarSeries(parent),
355 384 m_axes(0)
356 385 {
357 386 m_axes = new DeclarativeAxes(this);
358 387 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
359 388 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
360 389 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
361 390 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
362 391 }
363 392
364 393 void DeclarativeHorizontalStackedBarSeries::classBegin()
365 394 {
366 395 }
367 396
368 397 void DeclarativeHorizontalStackedBarSeries::componentComplete()
369 398 {
370 399 foreach (QObject *child, children()) {
371 400 if (qobject_cast<DeclarativeBarSet *>(child)) {
372 401 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
373 402 } else if (qobject_cast<QVBarModelMapper *>(child)) {
374 403 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
375 404 mapper->setSeries(this);
376 405 } else if (qobject_cast<QHBarModelMapper *>(child)) {
377 406 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
378 407 mapper->setSeries(this);
379 408 }
380 409 }
381 410 }
382 411
383 412 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalStackedBarSeries::seriesChildren()
384 413 {
385 414 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalStackedBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
386 415 }
387 416
388 417 void DeclarativeHorizontalStackedBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
389 418 {
390 419 // Empty implementation; the children are parsed in componentComplete instead
391 420 Q_UNUSED(list);
392 421 Q_UNUSED(element);
393 422 }
394 423
395 424 DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::at(int index)
396 425 {
397 426 QList<QBarSet *> setList = barSets();
398 427 if (index >= 0 && index < setList.count())
399 428 return qobject_cast<DeclarativeBarSet *>(setList[index]);
400 429
401 430 return 0;
402 431 }
403 432
404 433 DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::insert(int index, QString label, QVariantList values)
405 434 {
406 435 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
407 436 barset->setLabel(label);
408 437 barset->setValues(values);
409 438 if (QHorizontalStackedBarSeries::insert(index, barset))
410 439 return barset;
411 440 delete barset;
412 441 return 0;
413 442 }
414 443
415 444 // Declarative horizontal percent bar series ===================================================================
416 445 DeclarativeHorizontalPercentBarSeries::DeclarativeHorizontalPercentBarSeries(QDECLARATIVE_ITEM *parent) :
417 446 QHorizontalPercentBarSeries(parent),
418 447 m_axes(0)
419 448 {
420 449 m_axes = new DeclarativeAxes(this);
421 450 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
422 451 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
423 452 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
424 453 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
425 454 }
426 455
427 456 void DeclarativeHorizontalPercentBarSeries::classBegin()
428 457 {
429 458 }
430 459
431 460 void DeclarativeHorizontalPercentBarSeries::componentComplete()
432 461 {
433 462 foreach (QObject *child, children()) {
434 463 if (qobject_cast<DeclarativeBarSet *>(child)) {
435 464 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
436 465 } else if (qobject_cast<QVBarModelMapper *>(child)) {
437 466 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
438 467 mapper->setSeries(this);
439 468 } else if (qobject_cast<QHBarModelMapper *>(child)) {
440 469 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
441 470 mapper->setSeries(this);
442 471 }
443 472 }
444 473 }
445 474
446 475 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalPercentBarSeries::seriesChildren()
447 476 {
448 477 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalPercentBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
449 478 }
450 479
451 480 void DeclarativeHorizontalPercentBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
452 481 {
453 482 // Empty implementation; the children are parsed in componentComplete instead
454 483 Q_UNUSED(list);
455 484 Q_UNUSED(element);
456 485 }
457 486
458 487 DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::at(int index)
459 488 {
460 489 QList<QBarSet *> setList = barSets();
461 490 if (index >= 0 && index < setList.count())
462 491 return qobject_cast<DeclarativeBarSet *>(setList[index]);
463 492
464 493 return 0;
465 494 }
466 495
467 496 DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::insert(int index, QString label, QVariantList values)
468 497 {
469 498 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
470 499 barset->setLabel(label);
471 500 barset->setValues(values);
472 501 if (QHorizontalPercentBarSeries::insert(index, barset))
473 502 return barset;
474 503 delete barset;
475 504 return 0;
476 505 }
477 506
478 507 #include "moc_declarativebarseries.cpp"
479 508
480 509 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,406 +1,415
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef DECLARATIVEBARSERIES_H
22 22 #define DECLARATIVEBARSERIES_H
23 23
24 24 #include "qbarseries.h"
25 25 #include "qstackedbarseries.h"
26 26 #include "qpercentbarseries.h"
27 27 #include "qhorizontalbarseries.h"
28 28 #include "qhorizontalstackedbarseries.h"
29 29 #include "qhorizontalpercentbarseries.h"
30 30 #include "qbarset.h"
31 31 #include "declarativeaxes.h"
32 32 #include "shared_defines.h"
33 33
34 34 #ifdef CHARTS_FOR_QUICK2
35 35 #include <QtQuick/QQuickItem>
36 36 #include <QtQml/QQmlParserStatus>
37 37 #else
38 38 #include <QtDeclarative/QDeclarativeItem>
39 39 #include <QtDeclarative/QDeclarativeParserStatus>
40 40 #endif
41 41
42 42 QTCOMMERCIALCHART_BEGIN_NAMESPACE
43 43
44 44 class QChart;
45 45
46 46 class DeclarativeBarSet : public QBarSet
47 47 {
48 48 Q_OBJECT
49 49 Q_PROPERTY(QVariantList values READ values WRITE setValues)
50 50 Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
51 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 54 public:
54 55 explicit DeclarativeBarSet(QObject *parent = 0);
55 56 QVariantList values();
56 57 void setValues(QVariantList values);
57 58 qreal borderWidth() const;
58 59 void setBorderWidth(qreal borderWidth);
60 QString brushFilename() const;
61 void setBrushFilename(const QString &brushFilename);
59 62
60 63 public: // From QBarSet
61 64 Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
62 65 Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); }
63 66 Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); }
64 67 Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); }
65 68
66 69 Q_SIGNALS:
67 70 void countChanged(int count);
68 71 Q_REVISION(1) void borderWidthChanged(qreal width);
72 Q_REVISION(2) void brushFilenameChanged(const QString &brushFilename);
69 73
70 74 private Q_SLOTS:
71 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 83 class DeclarativeBarSeries : public QBarSeries, public QDECLARATIVE_PARSER_STATUS
75 84 {
76 85 Q_OBJECT
77 86 #ifdef CHARTS_FOR_QUICK2
78 87 Q_INTERFACES(QQmlParserStatus)
79 88 #else
80 89 Q_INTERFACES(QDeclarativeParserStatus)
81 90 #endif
82 91 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
83 92 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
84 93 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
85 94 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
86 95 #ifdef CHARTS_FOR_QUICK2
87 96 Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
88 97 #else
89 98 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
90 99 #endif
91 100 Q_CLASSINFO("DefaultProperty", "seriesChildren")
92 101
93 102 public:
94 103 explicit DeclarativeBarSeries(QDECLARATIVE_ITEM *parent = 0);
95 104 QAbstractAxis *axisX() { return m_axes->axisX(); }
96 105 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
97 106 QAbstractAxis *axisY() { return m_axes->axisY(); }
98 107 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
99 108 Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
100 109 Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
101 110 Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
102 111 Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
103 112 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
104 113
105 114 public:
106 115 Q_INVOKABLE DeclarativeBarSet *at(int index);
107 116 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
108 117 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
109 118 Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
110 119 Q_INVOKABLE void clear() { return QBarSeries::clear(); }
111 120
112 121 public: // from QDeclarativeParserStatus
113 122 void classBegin();
114 123 void componentComplete();
115 124
116 125 Q_SIGNALS:
117 126 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
118 127 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
119 128 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
120 129 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
121 130
122 131 public Q_SLOTS:
123 132 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
124 133
125 134 public:
126 135 DeclarativeAxes *m_axes;
127 136 };
128 137
129 138 class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDECLARATIVE_PARSER_STATUS
130 139 {
131 140 Q_OBJECT
132 141 #ifdef CHARTS_FOR_QUICK2
133 142 Q_INTERFACES(QQmlParserStatus)
134 143 #else
135 144 Q_INTERFACES(QDeclarativeParserStatus)
136 145 #endif
137 146 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
138 147 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
139 148 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
140 149 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
141 150 #ifdef CHARTS_FOR_QUICK2
142 151 Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
143 152 #else
144 153 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
145 154 #endif
146 155 Q_CLASSINFO("DefaultProperty", "seriesChildren")
147 156
148 157 public:
149 158 explicit DeclarativeStackedBarSeries(QDECLARATIVE_ITEM *parent = 0);
150 159 QAbstractAxis *axisX() { return m_axes->axisX(); }
151 160 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
152 161 QAbstractAxis *axisY() { return m_axes->axisY(); }
153 162 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
154 163 Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
155 164 Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
156 165 Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
157 166 Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
158 167 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
159 168
160 169 public:
161 170 Q_INVOKABLE DeclarativeBarSet *at(int index);
162 171 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
163 172 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
164 173 Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); }
165 174 Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); }
166 175
167 176 public: // from QDeclarativeParserStatus
168 177 void classBegin();
169 178 void componentComplete();
170 179
171 180 Q_SIGNALS:
172 181 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
173 182 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
174 183 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
175 184 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
176 185
177 186 public Q_SLOTS:
178 187 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
179 188
180 189 public:
181 190 DeclarativeAxes *m_axes;
182 191 };
183 192
184 193 class DeclarativePercentBarSeries : public QPercentBarSeries, public QDECLARATIVE_PARSER_STATUS
185 194 {
186 195 Q_OBJECT
187 196 #ifdef CHARTS_FOR_QUICK2
188 197 Q_INTERFACES(QQmlParserStatus)
189 198 #else
190 199 Q_INTERFACES(QDeclarativeParserStatus)
191 200 #endif
192 201 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
193 202 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
194 203 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
195 204 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
196 205 #ifdef CHARTS_FOR_QUICK2
197 206 Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
198 207 #else
199 208 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
200 209 #endif
201 210 Q_CLASSINFO("DefaultProperty", "seriesChildren")
202 211
203 212 public:
204 213 explicit DeclarativePercentBarSeries(QDECLARATIVE_ITEM *parent = 0);
205 214 QAbstractAxis *axisX() { return m_axes->axisX(); }
206 215 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
207 216 QAbstractAxis *axisY() { return m_axes->axisY(); }
208 217 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
209 218 Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
210 219 Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
211 220 Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
212 221 Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
213 222 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
214 223
215 224 public:
216 225 Q_INVOKABLE DeclarativeBarSet *at(int index);
217 226 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
218 227 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
219 228 Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); }
220 229 Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); }
221 230
222 231 public: // from QDeclarativeParserStatus
223 232 void classBegin();
224 233 void componentComplete();
225 234
226 235 Q_SIGNALS:
227 236 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
228 237 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
229 238 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
230 239 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
231 240
232 241 public Q_SLOTS:
233 242 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
234 243
235 244 public:
236 245 DeclarativeAxes *m_axes;
237 246 };
238 247
239 248 class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QDECLARATIVE_PARSER_STATUS
240 249 {
241 250 Q_OBJECT
242 251 #ifdef CHARTS_FOR_QUICK2
243 252 Q_INTERFACES(QQmlParserStatus)
244 253 #else
245 254 Q_INTERFACES(QDeclarativeParserStatus)
246 255 #endif
247 256 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
248 257 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
249 258 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
250 259 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
251 260 #ifdef CHARTS_FOR_QUICK2
252 261 Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
253 262 #else
254 263 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
255 264 #endif
256 265 Q_CLASSINFO("DefaultProperty", "seriesChildren")
257 266
258 267 public:
259 268 explicit DeclarativeHorizontalBarSeries(QDECLARATIVE_ITEM *parent = 0);
260 269 QAbstractAxis *axisX() { return m_axes->axisX(); }
261 270 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
262 271 QAbstractAxis *axisY() { return m_axes->axisY(); }
263 272 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
264 273 Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
265 274 Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
266 275 Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
267 276 Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
268 277 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
269 278
270 279 public:
271 280 Q_INVOKABLE DeclarativeBarSet *at(int index);
272 281 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
273 282 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
274 283 Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalBarSeries::remove(barset); }
275 284 Q_INVOKABLE void clear() { return QHorizontalBarSeries::clear(); }
276 285
277 286 public: // from QDeclarativeParserStatus
278 287 void classBegin();
279 288 void componentComplete();
280 289
281 290 Q_SIGNALS:
282 291 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
283 292 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
284 293 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
285 294 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
286 295
287 296 public Q_SLOTS:
288 297 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
289 298
290 299 public:
291 300 DeclarativeAxes *m_axes;
292 301 };
293 302
294 303 class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QDECLARATIVE_PARSER_STATUS
295 304 {
296 305 Q_OBJECT
297 306 #ifdef CHARTS_FOR_QUICK2
298 307 Q_INTERFACES(QQmlParserStatus)
299 308 #else
300 309 Q_INTERFACES(QDeclarativeParserStatus)
301 310 #endif
302 311 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
303 312 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
304 313 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
305 314 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
306 315 #ifdef CHARTS_FOR_QUICK2
307 316 Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
308 317 #else
309 318 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
310 319 #endif
311 320 Q_CLASSINFO("DefaultProperty", "seriesChildren")
312 321
313 322 public:
314 323 explicit DeclarativeHorizontalStackedBarSeries(QDECLARATIVE_ITEM *parent = 0);
315 324 QAbstractAxis *axisX() { return m_axes->axisX(); }
316 325 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
317 326 QAbstractAxis *axisY() { return m_axes->axisY(); }
318 327 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
319 328 Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
320 329 Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
321 330 Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
322 331 Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
323 332 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
324 333
325 334 public:
326 335 Q_INVOKABLE DeclarativeBarSet *at(int index);
327 336 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
328 337 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
329 338 Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalStackedBarSeries::remove(barset); }
330 339 Q_INVOKABLE void clear() { return QHorizontalStackedBarSeries::clear(); }
331 340
332 341 public: // from QDeclarativeParserStatus
333 342 void classBegin();
334 343 void componentComplete();
335 344
336 345 Q_SIGNALS:
337 346 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
338 347 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
339 348 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
340 349 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
341 350
342 351 public Q_SLOTS:
343 352 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
344 353
345 354 public:
346 355 DeclarativeAxes *m_axes;
347 356 };
348 357
349 358 class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QDECLARATIVE_PARSER_STATUS
350 359 {
351 360 Q_OBJECT
352 361 #ifdef CHARTS_FOR_QUICK2
353 362 Q_INTERFACES(QQmlParserStatus)
354 363 #else
355 364 Q_INTERFACES(QDeclarativeParserStatus)
356 365 #endif
357 366 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
358 367 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
359 368 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
360 369 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
361 370 #ifdef CHARTS_FOR_QUICK2
362 371 Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
363 372 #else
364 373 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
365 374 #endif
366 375 Q_CLASSINFO("DefaultProperty", "seriesChildren")
367 376
368 377 public:
369 378 explicit DeclarativeHorizontalPercentBarSeries(QDECLARATIVE_ITEM *parent = 0);
370 379 QAbstractAxis *axisX() { return m_axes->axisX(); }
371 380 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
372 381 QAbstractAxis *axisY() { return m_axes->axisY(); }
373 382 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
374 383 Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
375 384 Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
376 385 Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
377 386 Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
378 387 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
379 388
380 389 public:
381 390 Q_INVOKABLE DeclarativeBarSet *at(int index);
382 391 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
383 392 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
384 393 Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalPercentBarSeries::remove(barset); }
385 394 Q_INVOKABLE void clear() { return QHorizontalPercentBarSeries::clear(); }
386 395
387 396 public: // from QDeclarativeParserStatus
388 397 void classBegin();
389 398 void componentComplete();
390 399
391 400 Q_SIGNALS:
392 401 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
393 402 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
394 403 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
395 404 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
396 405
397 406 public Q_SLOTS:
398 407 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
399 408
400 409 public:
401 410 DeclarativeAxes *m_axes;
402 411 };
403 412
404 413 QTCOMMERCIALCHART_END_NAMESPACE
405 414
406 415 #endif // DECLARATIVEBARSERIES_H
@@ -1,339 +1,397
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "declarativebarseries.h"
22 22 #include "declarativeboxplotseries.h"
23 23 #include "qboxset.h"
24 24 #include "qvboxplotmodelmapper.h"
25 25
26 26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 27
28 28 #ifdef QDOC_QT5
29 29 /*!
30 30 \qmltype BoxSet
31 31 \instantiates QBoxSet
32 32 \inqmlmodule QtCommercial.Chart
33 33
34 34 \include doc/src/declarativeboxset.qdocinc
35 35 */
36 36 #else
37 37 /*!
38 38 \qmlclass BoxSet QBoxSet
39 39
40 40 \include ../doc/src/declarativeboxset.qdocinc
41 41 */
42 42 #endif
43 43 /*!
44 44 \qmlproperty string BoxSet::values
45 45 The values on the box-and-whiskers set.
46 46 */
47 47 /*!
48 48 \qmlproperty string BoxSet::label
49 49 Defines the label of the box-and-whiskers set.
50 50 */
51 51 /*!
52 52 \qmlproperty int BoxSet::count
53 53 The count of values on the box-and-whiskers set
54 54 */
55 55 /*!
56 56 \qmlmethod void BoxSet::at(int index)
57 57 Returns the value at \a index position.
58 58 */
59 59 /*!
60 60 \qmlmethod void BoxSet::append(qreal value)
61 61 Appends new value \a value to the end of set.
62 62 */
63 63 /*!
64 64 \qmlmethod void BoxSet::clear()
65 65 Sets all values on the set to 0.
66 66 */
67 67 /*!
68 68 \qmlmethod void BoxSet::setValue(int index, qreal value)
69 69 Sets a new \a value on the \a index position.
70 70 */
71 71 /*!
72 72 \qmlsignal BoxSet::onClicked()
73 73 This signal is emitted when the user clicks with a mouse on top of box-and-whiskers item.
74 74 */
75 75 /*!
76 76 \qmlsignal BoxSet::onHovered(bool status)
77 77 The signal is emitted if mouse is hovered on top of box-and-whiskers item.
78 78 Parameter \a status is true, if mouse entered on top of the item, and false if mouse left from top of the item.
79 79 */
80 80 /*!
81 81 \qmlsignal BoxSet::onPenChanged()
82 82 This signal is emitted when the pen of the box-and-whiskers item has changed.
83 83 */
84 84 /*!
85 85 \qmlsignal BoxSet::onBrushChanged()
86 86 This signal is emitted when the brush of the box-and-whiskers item has changed.
87 87 */
88 88 /*!
89 89 \qmlsignal BoxSet::onChangedValues()
90 90 This signal is emitted when multiple values have been changed on the box-and-whiskers item.
91 91 */
92 92 /*!
93 93 \qmlsignal BoxSet::onChangedValue(int index)
94 94 This signal is emitted values the value in the box-and-whiskers item has been modified.
95 95 Parameter \a index indicates the position of the modified value.
96 96 */
97 97 /*!
98 98 \qmlsignal BoxSet::onCleared()
99 99 This signal is emitted when all the values on the set are cleared to 0.
100 100 */
101 101
102 102
103 103 #ifdef QDOC_QT5
104 104 /*!
105 105 \qmltype BoxPlotSeries
106 106 \instantiates QBoxPlotSeries
107 107 \inqmlmodule QtCommercial.Chart
108 108
109 109 \include doc/src/declarativeboxplotseries.qdocinc
110 110 */
111 111 #else
112 112 /*!
113 113 \qmlclass BoxPlotSeries QBoxPlotSeries
114 114
115 115 \include ../doc/src/declarativeboxplotseries.qdocinc
116 116 */
117 117 #endif
118 118
119 119 /*!
120 120 \qmlmethod BoxPlotSeries::append(string label, VariantList values)
121 121 Appends a new box-and-whiskers set with \a label and \a values to the series.
122 122 */
123 123 /*!
124 124 \qmlmethod BoxPlotSeries::append(BoxSet box)
125 125 Appends the \a box to the series.
126 126 */
127 127 /*!
128 128 \qmlmethod BoxPlotSeries::insert(int index, string label, VariantList values)
129 129 Inserts a new box-and-whiskers set with \a label and \a values at the \a index position.
130 130 */
131 131 /*!
132 132 \qmlmethod BoxPlotSeries::remove(QBoxSet boxset)
133 133 Removes the \a boxset from the series.
134 134 */
135 135 /*!
136 136 \qmlmethod BoxPlotSeries::clear()
137 137 Removes all boxsets from the series. Deletes removed sets.
138 138 */
139 139 /*!
140 140 \qmlsignal BoxPlotSeries::onClicked(BoxSet boxset);
141 141 Signal is emitted when the user clicks the \a boxset on the chart.
142 142 */
143 143 /*!
144 144 \qmlsignal BoxPlotSeries::onHovered(bool status, BoxSet boxset);
145 145 Signal is emitted when there is change in hover \a status over \a boxset.
146 146 */
147 147 /*!
148 148 \qmlsignal BoxPlotSeries::onCountChanged();
149 149 Signal is emitted when there is change in count of box-and-whiskers items in the series.
150 150 */
151 151 /*!
152 152 \qmlsignal BoxPlotSeries::onBoxsetsAdded()
153 153 Signal is emitted when new box-and-whiskers sets are added to the series.
154 154 */
155 155 /*!
156 156 \qmlsignal BoxPlotSeries::onBoxsetsRemoved()
157 157 Signal is emitted when new box-and-whiskers sets are removed from the series.
158 158 */
159 159 /*!
160 160 \qmlproperty AbstractAxis BoxPlotSeries::axisX
161 161 The x axis used for the series. If you leave both axisX and axisXTop undefined, a BarCategoriesAxis is created for
162 162 the series.
163 163 \sa axisXTop
164 164 */
165 165 /*!
166 166 \qmlproperty AbstractAxis BoxPlotSeries::axisY
167 167 The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
168 168 the series.
169 169 \sa axisYRight
170 170 */
171 171 /*!
172 172 \qmlproperty AbstractAxis BoxPlotSeries::axisXTop
173 173 The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
174 174 axisXTop, but not both.
175 175 \sa axisX
176 176 */
177 177 /*!
178 178 \qmlproperty AbstractAxis BoxPlotSeries::axisYRight
179 179 The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
180 180 or axisYRight, but not both.
181 181 \sa axisY
182 182 */
183 183 /*!
184 184 \qmlproperty bool BoxPlotSeries::boxOutlineVisible
185 185 This property configures the visibility of the middle box outline.
186 186 */
187 187 /*!
188 188 \qmlproperty qreal BoxPlotSeries::boxWidth
189 189 This property configures the width of the box-and-whiskers item. The value signifies the relative
190 190 width of the box-and-whiskers item inside its own slot. The value can between 0.0 and 1.0. Negative values
191 191 are clamped to 0.0 and values over 1.0 are clamped to 1.0.
192 192 */
193 193 /*!
194 194 \qmlproperty Pen BoxPlotSeries::pen
195 195 This property configures the pen of the box-and-whiskers items.
196 196 */
197 197 /*!
198 198 \qmlproperty Brush BoxPlotSeries::brush
199 199 This property configures the brush of the box-and-whiskers items.
200 200 */
201 201 /*!
202 202 \qmlsignal BoxPlotSeries::onBoxOutlineVisibilityChanged()
203 203 Signal is emitted when the middle box outline visibility is changed.
204 204 */
205 205 /*!
206 206 \qmlsignal BoxPlotSeries::onBoxWidthChanged()
207 207 Signal is emitted when the width of the box-and-whiskers item is changed.
208 208 */
209 209 /*!
210 210 \qmlsignal BoxPlotSeries::onPenChanged()
211 211 Signal is emitted when the pen for box-and-whiskers items has changed.
212 212 */
213 213 /*!
214 214 \qmlsignal BoxPlotSeries::onBrushChanged()
215 215 Signal is emitted when the brush for box-and-whiskers items has changed.
216 216 */
217 217 /*!
218 218 \qmlsignal BoxPlotSeries::onClicked(BoxSet boxset)
219 219 Signal is emitted when the user clicks the \a boxset on the chart.
220 220 */
221 221 /*!
222 222 \qmlsignal BoxPlotSeries::onHovered(bool status, BoxSet boxset)
223 223 Signal is emitted when there is change in hover \a status over \a boxset.
224 224 */
225 225 /*!
226 226 \qmlsignal BoxPlotSeries::onAxisXChanged(AbstractAxis axis)
227 227 Signal is emitted when there is change in X axis.
228 228 */
229 229 /*!
230 230 \qmlsignal BoxPlotSeries::onAxisYChanged(AbstractAxis axis)
231 231 Signal is emitted when there is change in Y axis.
232 232 */
233 233 /*!
234 234 \qmlsignal BoxPlotSeries::onAxisXTopChanged(AbstractAxis axis)
235 235 Signal is emitted when there is change in top X axis.
236 236 */
237 237 /*!
238 238 \qmlsignal BoxPlotSeries::onAxisYRightChanged(AbstractAxis axis)
239 239 Signal is emitted when there is change in Y right axis.
240 240 */
241 241
242 242
243 243 DeclarativeBoxSet::DeclarativeBoxSet(const QString label, QObject *parent)
244 244 : QBoxSet(label, parent)
245 245 {
246 246 connect(this, SIGNAL(valuesChanged()), this, SIGNAL(changedValues()));
247 247 connect(this, SIGNAL(valueChanged(int)), this, SIGNAL(changedValue(int)));
248 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
248 249 }
249 250
250 251 QVariantList DeclarativeBoxSet::values()
251 252 {
252 253 QVariantList values;
253 254 for (int i(0); i < 5; i++)
254 255 values.append(QVariant(QBoxSet::at(i)));
255 256 return values;
256 257 }
257 258
258 259 void DeclarativeBoxSet::setValues(QVariantList values)
259 260 {
260 261 for (int i(0); i < values.count(); i++) {
261 262 if (values.at(i).canConvert(QVariant::Double))
262 263 QBoxSet::append(values[i].toDouble());
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 297 DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent) :
269 298 QBoxPlotSeries(parent),
270 299 m_axes(new DeclarativeAxes(this))
271 300 {
272 301 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
273 302 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
274 303 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
275 304 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
276 305 connect(this, SIGNAL(hovered(bool, QBoxSet*)), this, SLOT(onHovered(bool, QBoxSet*)));
277 306 connect(this, SIGNAL(clicked(QBoxSet*)), this, SLOT(onClicked(QBoxSet*)));
307 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
278 308 }
279 309
280 310 void DeclarativeBoxPlotSeries::classBegin()
281 311 {
282 312 }
283 313
284 314 void DeclarativeBoxPlotSeries::componentComplete()
285 315 {
286 316 foreach (QObject *child, children()) {
287 317 if (qobject_cast<DeclarativeBoxSet *>(child)) {
288 318 QBoxPlotSeries::append(qobject_cast<DeclarativeBoxSet *>(child));
289 319 } else if (qobject_cast<QVBoxPlotModelMapper *>(child)) {
290 320 QVBoxPlotModelMapper *mapper = qobject_cast<QVBoxPlotModelMapper *>(child);
291 321 mapper->setSeries(this);
292 322 }
293 323 }
294 324 }
295 325
296 326 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeBoxPlotSeries::seriesChildren()
297 327 {
298 328 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBoxPlotSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
299 329 }
300 330
301 331 void DeclarativeBoxPlotSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
302 332 {
303 333 // Empty implementation; the children are parsed in componentComplete instead
304 334 Q_UNUSED(list);
305 335 Q_UNUSED(element);
306 336 }
307 337
308 338 DeclarativeBoxSet *DeclarativeBoxPlotSeries::at(int index)
309 339 {
310 340 QList<QBoxSet *> setList = boxSets();
311 341 if (index >= 0 && index < setList.count())
312 342 return qobject_cast<DeclarativeBoxSet *>(setList[index]);
313 343
314 344 return 0;
315 345 }
316 346
317 347 DeclarativeBoxSet *DeclarativeBoxPlotSeries::insert(int index, const QString label, QVariantList values)
318 348 {
319 349 DeclarativeBoxSet *barset = new DeclarativeBoxSet(label, this);
320 350 barset->setValues(values);
321 351 if (QBoxPlotSeries::insert(index, barset))
322 352 return barset;
323 353 delete barset;
324 354 return 0;
325 355 }
326 356
327 357 void DeclarativeBoxPlotSeries::onHovered(bool status, QBoxSet *boxset)
328 358 {
329 359 emit hovered(status, qobject_cast<DeclarativeBoxSet *>(boxset));
330 360 }
331 361
332 362 void DeclarativeBoxPlotSeries::onClicked(QBoxSet *boxset)
333 363 {
334 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 395 #include "moc_declarativeboxplotseries.cpp"
338 396
339 397 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,132 +1,154
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef DECLARATIVEBOXPLOT_H
22 22 #define DECLARATIVEBOXPLOT_H
23 23
24 24 #include "qboxset.h"
25 25 #include "declarativeaxes.h"
26 26 #include "qboxplotseries.h"
27 27 #ifdef CHARTS_FOR_QUICK2
28 28 #include <QtQuick/QQuickItem>
29 29 #include <QtQml/QQmlParserStatus>
30 30 #else
31 31 #include <QtDeclarative/QDeclarativeItem>
32 32 #include <QtDeclarative/QDeclarativeParserStatus>
33 33 #endif
34 34
35 35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 36
37 37 class DeclarativeBoxSet : public QBoxSet
38 38 {
39 39 Q_OBJECT
40 40 Q_PROPERTY(QVariantList values READ values WRITE setValues)
41 41 Q_PROPERTY(QString label READ label WRITE setLabel)
42 42 Q_PROPERTY(int count READ count)
43 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
43 44 Q_ENUMS(ValuePositions)
44 45
45 46 public: // duplicate from QBoxSet
46 47 enum ValuePositions {
47 48 LowerExtreme = 0x0,
48 49 LowerQuartile,
49 50 Median,
50 51 UpperQuartile,
51 52 UpperExtreme
52 53 };
53 54
54 55 public:
55 56 explicit DeclarativeBoxSet(const QString label = "", QObject *parent = 0);
56 57 QVariantList values();
57 58 void setValues(QVariantList values);
59 QString brushFilename() const;
60 void setBrushFilename(const QString &brushFilename);
58 61
59 62 public: // From QBoxSet
60 63 Q_INVOKABLE void append(qreal value) { QBoxSet::append(value); }
61 64 Q_INVOKABLE void clear() {QBoxSet::clear(); }
62 65 Q_INVOKABLE qreal at(int index) { return QBoxSet::at(index); }
63 66 Q_INVOKABLE void setValue(int index, qreal value) { QBoxSet::setValue(index, value); }
64 67
65 68 Q_SIGNALS:
66 69 void changedValues();
67 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 81 class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QDECLARATIVE_PARSER_STATUS
71 82 {
72 83 Q_OBJECT
73 84 #ifdef CHARTS_FOR_QUICK2
74 85 Q_INTERFACES(QQmlParserStatus)
75 86 #else
76 87 Q_INTERFACES(QDeclarativeParserStatus)
77 88 #endif
78 89 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged)
79 90 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged)
80 91 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged)
81 92 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged)
82 93 #ifdef CHARTS_FOR_QUICK2
83 94 Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
84 95 #else
85 96 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
86 97 #endif
98 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
87 99 Q_CLASSINFO("DefaultProperty", "seriesChildren")
88 100
89 101 public:
90 102 explicit DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent = 0);
91 103 QAbstractAxis *axisX() { return m_axes->axisX(); }
92 104 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
93 105 QAbstractAxis *axisY() { return m_axes->axisY(); }
94 106 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
95 107 QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
96 108 void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
97 109 QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
98 110 void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
99 111 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
112 QString brushFilename() const;
113 void setBrushFilename(const QString &brushFilename);
100 114
101 115 public:
102 116 Q_INVOKABLE DeclarativeBoxSet *at(int index);
103 117 Q_INVOKABLE DeclarativeBoxSet *append(const QString label, QVariantList values) { return insert(count(), label, values); }
104 118 Q_INVOKABLE void append(DeclarativeBoxSet *box) { QBoxPlotSeries::append(box); }
105 119 Q_INVOKABLE DeclarativeBoxSet *insert(int index, const QString label, QVariantList values);
106 120 Q_INVOKABLE bool remove(DeclarativeBoxSet *box) { return QBoxPlotSeries::remove(qobject_cast<QBoxSet *>(box)); }
107 121 Q_INVOKABLE void clear() { return QBoxPlotSeries::clear(); }
108 122
109 123 public: // from QDeclarativeParserStatus
110 124 void classBegin();
111 125 void componentComplete();
112 126
113 127 Q_SIGNALS:
114 128 void axisXChanged(QAbstractAxis *axis);
115 129 void axisYChanged(QAbstractAxis *axis);
116 130 void axisXTopChanged(QAbstractAxis *axis);
117 131 void axisYRightChanged(QAbstractAxis *axis);
118 132 void clicked(DeclarativeBoxSet *boxset);
119 133 void hovered(bool status, DeclarativeBoxSet *boxset);
134 Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
120 135
121 136 public Q_SLOTS:
122 137 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
123 138 void onHovered(bool status, QBoxSet *boxset);
124 139 void onClicked(QBoxSet *boxset);
125 140
141 private Q_SLOTS:
142 void handleBrushChanged();
143
126 144 public:
127 145 DeclarativeAxes *m_axes;
146
147 private:
148 QString m_brushFilename;
149 QImage m_brushImage;
128 150 };
129 151
130 152 QTCOMMERCIALCHART_END_NAMESPACE
131 153
132 154 #endif // DECLARATIVEBOXPLOT_H
@@ -1,117 +1,154
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "declarativepieseries.h"
22 22 #include "qpieslice.h"
23 23 #include "qvpiemodelmapper.h"
24 24 #include "qhpiemodelmapper.h"
25 25
26 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 63 DeclarativePieSeries::DeclarativePieSeries(QDECLARATIVE_ITEM *parent) :
29 64 QPieSeries(parent)
30 65 {
31 66 connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>)));
32 67 connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>)));
33 68 }
34 69
35 70 void DeclarativePieSeries::classBegin()
36 71 {
37 72 }
38 73
39 74 void DeclarativePieSeries::componentComplete()
40 75 {
41 76 foreach (QObject *child, children()) {
42 77 if (qobject_cast<QPieSlice *>(child)) {
43 78 QPieSeries::append(qobject_cast<QPieSlice *>(child));
44 79 } else if (qobject_cast<QVPieModelMapper *>(child)) {
45 80 QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child);
46 81 mapper->setSeries(this);
47 82 } else if (qobject_cast<QHPieModelMapper *>(child)) {
48 83 QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child);
49 84 mapper->setSeries(this);
50 85 }
51 86 }
52 87 }
53 88
54 89 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativePieSeries::seriesChildren()
55 90 {
56 91 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
57 92 }
58 93
59 94 void DeclarativePieSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
60 95 {
61 96 // Empty implementation; the children are parsed in componentComplete instead
62 97 Q_UNUSED(list);
63 98 Q_UNUSED(element);
64 99 }
65 100
66 101 QPieSlice *DeclarativePieSeries::at(int index)
67 102 {
68 103 QList<QPieSlice *> sliceList = slices();
69 104 if (index >= 0 && index < sliceList.count())
70 105 return sliceList[index];
71 106
72 107 return 0;
73 108 }
74 109
75 110 QPieSlice *DeclarativePieSeries::find(QString label)
76 111 {
77 112 foreach (QPieSlice *slice, slices()) {
78 113 if (slice->label() == label)
79 114 return slice;
80 115 }
81 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 122 slice->setLabel(label);
88 123 slice->setValue(value);
89 QPieSeries::append(slice);
90 return slice;
124 if (QPieSeries::append(slice))
125 return slice;
126 delete slice;
127 return 0;
91 128 }
92 129
93 130 bool DeclarativePieSeries::remove(QPieSlice *slice)
94 131 {
95 132 return QPieSeries::remove(slice);
96 133 }
97 134
98 135 void DeclarativePieSeries::clear()
99 136 {
100 137 QPieSeries::clear();
101 138 }
102 139
103 140 void DeclarativePieSeries::handleAdded(QList<QPieSlice *> slices)
104 141 {
105 142 foreach (QPieSlice *slice, slices)
106 143 emit sliceAdded(slice);
107 144 }
108 145
109 146 void DeclarativePieSeries::handleRemoved(QList<QPieSlice *> slices)
110 147 {
111 148 foreach (QPieSlice *slice, slices)
112 149 emit sliceRemoved(slice);
113 150 }
114 151
115 152 #include "moc_declarativepieseries.cpp"
116 153
117 154 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,75 +1,96
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef DECLARATIVEPIESERIES_H
22 22 #define DECLARATIVEPIESERIES_H
23 23
24 24 #include "qpieseries.h"
25 #include "qpieslice.h"
25 26 #include "shared_defines.h"
26 27
27 28 #ifdef CHARTS_FOR_QUICK2
28 29 #include <QtQuick/QQuickItem>
29 30 #include <QtQml/QQmlParserStatus>
30 31 #else
31 32 #include <QtDeclarative/QDeclarativeItem>
32 33 #include <QtDeclarative/QDeclarativeParserStatus>
33 34 #endif
34 35
35 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 59 class DeclarativePieSeries : public QPieSeries, public QDECLARATIVE_PARSER_STATUS
39 60 {
40 61 Q_OBJECT
41 62 #ifdef CHARTS_FOR_QUICK2
42 63 Q_INTERFACES(QQmlParserStatus)
43 64 Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
44 65 #else
45 66 Q_INTERFACES(QDeclarativeParserStatus)
46 67 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
47 68 #endif
48 69 Q_CLASSINFO("DefaultProperty", "seriesChildren")
49 70
50 71 public:
51 72 explicit DeclarativePieSeries(QDECLARATIVE_ITEM *parent = 0);
52 73 QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
53 74 Q_INVOKABLE QPieSlice *at(int index);
54 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 77 Q_INVOKABLE bool remove(QPieSlice *slice);
57 78 Q_INVOKABLE void clear();
58 79
59 80 public:
60 81 void classBegin();
61 82 void componentComplete();
62 83
63 84 Q_SIGNALS:
64 85 void sliceAdded(QPieSlice *slice);
65 86 void sliceRemoved(QPieSlice *slice);
66 87
67 88 public Q_SLOTS:
68 89 static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
69 90 void handleAdded(QList<QPieSlice *> slices);
70 91 void handleRemoved(QList<QPieSlice *> slices);
71 92 };
72 93
73 94 QTCOMMERCIALCHART_END_NAMESPACE
74 95
75 96 #endif // DECLARATIVEPIESERIES_H
@@ -1,74 +1,114
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "declarativescatterseries.h"
22 22
23 23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 24
25 25 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
26 26 QScatterSeries(parent),
27 27 m_axes(new DeclarativeAxes(this))
28 28 {
29 29 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
30 30 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
31 31 connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
32 32 connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
33 33 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
34 34 connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
35 35 connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
36 36 connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
37 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
37 38 }
38 39
39 40 void DeclarativeScatterSeries::handleCountChanged(int index)
40 41 {
41 42 Q_UNUSED(index)
42 43 emit countChanged(QScatterSeries::count());
43 44 }
44 45
45 46 qreal DeclarativeScatterSeries::borderWidth() const
46 47 {
47 48 return pen().widthF();
48 49 }
49 50
50 51 void DeclarativeScatterSeries::setBorderWidth(qreal width)
51 52 {
52 53 if (width != pen().widthF()) {
53 54 QPen p = pen();
54 55 p.setWidthF(width);
55 56 setPen(p);
56 57 emit borderWidthChanged(width);
57 58 }
58 59 }
59 60
60 61 QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeScatterSeries::declarativeChildren()
61 62 {
62 63 return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS);
63 64 }
64 65
65 66 void DeclarativeScatterSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
66 67 {
67 68 Q_UNUSED(list)
68 69 Q_UNUSED(element)
69 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 112 #include "moc_declarativescatterseries.cpp"
73 113
74 114 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,115 +1,130
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef DECLARATIVESCATTERSERIES_H
22 22 #define DECLARATIVESCATTERSERIES_H
23 23
24 24 #include "qscatterseries.h"
25 25 #include "declarativexyseries.h"
26 26 #include "declarativeaxes.h"
27 27 #include "shared_defines.h"
28 28
29 29 #ifdef CHARTS_FOR_QUICK2
30 30 #include <QtQml/QQmlListProperty>
31 31 #include <QtQml/QQmlParserStatus>
32 32 #else
33 33 #include <QtDeclarative/QDeclarativeListProperty>
34 34 #include <QtDeclarative/QDeclarativeParserStatus>
35 35 #endif
36 36
37 37 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38 38
39 39 class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS
40 40 {
41 41 Q_OBJECT
42 42 #ifdef CHARTS_FOR_QUICK2
43 43 Q_INTERFACES(QQmlParserStatus)
44 44 #else
45 45 Q_INTERFACES(QDeclarativeParserStatus)
46 46 #endif
47 47 Q_PROPERTY(int count READ count NOTIFY countChanged)
48 48 Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
49 49 Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
50 50 Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
51 51 Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
52 52 Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
53 53 Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
54 54 Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
55 55 #ifdef CHARTS_FOR_QUICK2
56 56 Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
57 57 #else
58 58 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
59 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 62 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
61 63
62 64 public:
63 65 explicit DeclarativeScatterSeries(QObject *parent = 0);
64 66 QXYSeries *xySeries() { return this; }
65 67 QAbstractAxis *axisX() { return m_axes->axisX(); }
66 68 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
67 69 QAbstractAxis *axisY() { return m_axes->axisY(); }
68 70 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
69 71 Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
70 72 Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
71 73 Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
72 74 Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
73 75 Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
74 76 Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
75 77 Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
76 78 Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
77 79 qreal borderWidth() const;
78 80 void setBorderWidth(qreal borderWidth);
79 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 87 public: // from QDeclarativeParserStatus
82 88 void classBegin() { DeclarativeXySeries::classBegin(); }
83 89 void componentComplete() { DeclarativeXySeries::componentComplete(); }
84 90
85 91 public:
86 92 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
87 93 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
88 94 Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); }
89 95 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
90 96 Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); }
91 97 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
92 98 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
93 99 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
94 100
95 101 Q_SIGNALS:
96 102 void countChanged(int count);
97 103 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
98 104 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
99 105 Q_REVISION(1) void borderWidthChanged(qreal width);
100 106 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
101 107 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
102 108 Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
103 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 113 public Q_SLOTS:
106 114 static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
107 115 void handleCountChanged(int index);
108 116
117 private Q_SLOTS:
118 void handleBrushChanged();
119
109 120 public:
110 121 DeclarativeAxes *m_axes;
122
123 private:
124 QString m_brushFilename;
125 QImage m_brushImage;
111 126 };
112 127
113 128 QTCOMMERCIALCHART_END_NAMESPACE
114 129
115 130 #endif // DECLARATIVESCATTERSERIES_H
@@ -1,252 +1,261
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qchart.h"
22 22 #include "qabstractaxis.h"
23 23 #include "qvalueaxis.h"
24 24 #include "qlogvalueaxis.h"
25 25 #include "declarativecategoryaxis.h"
26 26 #include "qbarcategoryaxis.h"
27 27 #include "declarativechart.h"
28 28 #include "declarativepolarchart.h"
29 29 #include "declarativexypoint.h"
30 30 #include "declarativelineseries.h"
31 31 #include "declarativesplineseries.h"
32 32 #include "declarativeareaseries.h"
33 33 #include "declarativescatterseries.h"
34 34 #include "declarativebarseries.h"
35 35 #include "declarativeboxplotseries.h"
36 36 #include "declarativepieseries.h"
37 37 #include "declarativeaxes.h"
38 38 #include "qvxymodelmapper.h"
39 39 #include "qhxymodelmapper.h"
40 40 #include "qhpiemodelmapper.h"
41 41 #include "qvpiemodelmapper.h"
42 42 #include "qhbarmodelmapper.h"
43 43 #include "qvbarmodelmapper.h"
44 44 #include "declarativemargins.h"
45 45 #include "qarealegendmarker.h"
46 46 #include "qbarlegendmarker.h"
47 47 #include "qpielegendmarker.h"
48 48 #include "qxylegendmarker.h"
49 49 #ifndef QT_ON_ARM
50 50 #include "qdatetimeaxis.h"
51 51 #endif
52 52 #include "shared_defines.h"
53 53 #include <QAbstractItemModel>
54 54 #ifdef CHARTS_FOR_QUICK2
55 55 #include <QtQml/QQmlExtensionPlugin>
56 56 #else
57 57 #include <QtDeclarative/qdeclarativeextensionplugin.h>
58 58 #include <QtDeclarative/qdeclarative.h>
59 59 #endif
60 60
61 61 QTCOMMERCIALCHART_USE_NAMESPACE
62 62
63 63 Q_DECLARE_METATYPE(QList<QPieSlice *>)
64 64 Q_DECLARE_METATYPE(QList<QBarSet *>)
65 65 Q_DECLARE_METATYPE(QList<QAbstractAxis *>)
66 66
67 67 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
68 68
69 69 Q_DECLARE_METATYPE(DeclarativeChart *)
70 70 Q_DECLARE_METATYPE(DeclarativePolarChart *)
71 71 Q_DECLARE_METATYPE(DeclarativeMargins *)
72 72 Q_DECLARE_METATYPE(DeclarativeAreaSeries *)
73 73 Q_DECLARE_METATYPE(DeclarativeBarSeries *)
74 74 Q_DECLARE_METATYPE(DeclarativeBarSet *)
75 75 Q_DECLARE_METATYPE(DeclarativeBoxPlotSeries *)
76 76 Q_DECLARE_METATYPE(DeclarativeBoxSet *)
77 77 Q_DECLARE_METATYPE(DeclarativeLineSeries *)
78 78 Q_DECLARE_METATYPE(DeclarativePieSeries *)
79 Q_DECLARE_METATYPE(DeclarativePieSlice *)
79 80 Q_DECLARE_METATYPE(DeclarativeScatterSeries *)
80 81 Q_DECLARE_METATYPE(DeclarativeSplineSeries *)
81 82
82 83 Q_DECLARE_METATYPE(QAbstractAxis *)
83 84 Q_DECLARE_METATYPE(QValueAxis *)
84 85 Q_DECLARE_METATYPE(QBarCategoryAxis *)
85 86 Q_DECLARE_METATYPE(QCategoryAxis *)
86 87 Q_DECLARE_METATYPE(QDateTimeAxis *)
87 88 Q_DECLARE_METATYPE(QLogValueAxis *)
88 89
89 90 Q_DECLARE_METATYPE(QLegend *)
90 91 Q_DECLARE_METATYPE(QLegendMarker *)
91 92 Q_DECLARE_METATYPE(QAreaLegendMarker *)
92 93 Q_DECLARE_METATYPE(QBarLegendMarker *)
93 94 Q_DECLARE_METATYPE(QPieLegendMarker *)
94 95
95 96 Q_DECLARE_METATYPE(QHPieModelMapper *)
96 97 Q_DECLARE_METATYPE(QHXYModelMapper *)
97 98 Q_DECLARE_METATYPE(QPieModelMapper *)
98 99 Q_DECLARE_METATYPE(QHBarModelMapper *)
99 100 Q_DECLARE_METATYPE(QBarModelMapper *)
100 101 Q_DECLARE_METATYPE(QVBarModelMapper *)
101 102 Q_DECLARE_METATYPE(QVPieModelMapper *)
102 103 Q_DECLARE_METATYPE(QVXYModelMapper *)
103 104 Q_DECLARE_METATYPE(QXYLegendMarker *)
104 105 Q_DECLARE_METATYPE(QXYModelMapper *)
105 106
106 107 Q_DECLARE_METATYPE(QAbstractSeries *)
107 108 Q_DECLARE_METATYPE(QXYSeries *)
108 109 Q_DECLARE_METATYPE(QAbstractBarSeries *)
109 110 Q_DECLARE_METATYPE(QBarSeries *)
110 111 Q_DECLARE_METATYPE(QBarSet *)
111 112 Q_DECLARE_METATYPE(QAreaSeries *)
112 113 Q_DECLARE_METATYPE(QHorizontalBarSeries *)
113 114 Q_DECLARE_METATYPE(QHorizontalPercentBarSeries *)
114 115 Q_DECLARE_METATYPE(QHorizontalStackedBarSeries *)
115 116 Q_DECLARE_METATYPE(QLineSeries *)
116 117 Q_DECLARE_METATYPE(QPercentBarSeries *)
117 118 Q_DECLARE_METATYPE(QPieSeries *)
118 119 Q_DECLARE_METATYPE(QPieSlice *)
119 120 Q_DECLARE_METATYPE(QScatterSeries *)
120 121 Q_DECLARE_METATYPE(QSplineSeries *)
121 122 Q_DECLARE_METATYPE(QStackedBarSeries *)
122 123
123 124 #endif
124 125
125 126 QTCOMMERCIALCHART_BEGIN_NAMESPACE
126 127
127 128 class ChartQmlPlugin : public QDECLARATIVE_EXTENSION_PLUGIN
128 129 {
129 130 Q_OBJECT
130 131
131 132 #ifdef CHARTS_FOR_QUICK2
132 133 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
133 134 #else
134 135 # if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
135 136 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface")
136 137 # endif
137 138 #endif
138 139
139 140 public:
140 141 virtual void registerTypes(const char *uri)
141 142 {
142 143 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
143 144
144 145 qRegisterMetaType<QList<QPieSlice *> >();
145 146 qRegisterMetaType<QList<QBarSet *> >();
146 147 qRegisterMetaType<QList<QAbstractAxis *> >();
147 148
148 149 // QtCommercial.Chart 1.0
149 150 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
150 151 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
151 152 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
152 153 qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
153 154 qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
154 155 qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
155 156 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
156 157 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
157 158 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
158 159 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
159 160 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
160 161 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
161 162 qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
162 163 qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
163 164 qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
164 165 qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
165 166 qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
166 167 qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
167 168 qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis");
168 169 qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis");
169 170 qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
170 171 QLatin1String("Trying to create uncreatable: Legend."));
171 172 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
172 173 QLatin1String("Trying to create uncreatable: XYSeries."));
173 174 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
174 175 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
175 176 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
176 177 QLatin1String("Trying to create uncreatable: XYModelMapper."));
177 178 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
178 179 QLatin1String("Trying to create uncreatable: PieModelMapper."));
179 180 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
180 181 QLatin1String("Trying to create uncreatable: BarModelMapper."));
181 182 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
182 183 QLatin1String("Trying to create uncreatable: AbstractSeries."));
183 184 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
184 185 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
185 186 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
186 187 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
187 188 qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase",
188 189 QLatin1String("Trying to create uncreatable: BarsetBase."));
189 190 qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries",
190 191 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
191 192 qmlRegisterUncreatableType<DeclarativeAxes>(uri, 1, 0, "DeclarativeAxes",
192 193 QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
193 194
194 195 // QtCommercial.Chart 1.1
195 196 qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView");
196 197 qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries");
197 198 qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries");
198 199 qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries");
199 200 qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries");
200 201 qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries");
201 202 qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries");
202 203 qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries");
203 204 qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries");
204 205 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries");
205 206 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
206 207 qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
207 208 qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
208 209 qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
209 210 #ifndef QT_ON_ARM
210 211 qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
211 212 #endif
212 213 qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis");
213 214 qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange");
214 215 qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis");
215 216 qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins",
216 217 QLatin1String("Trying to create uncreatable: Margins."));
217 218
218 219 // QtCommercial.Chart 1.2
219 220 qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView");
220 221 qmlRegisterType<DeclarativeScatterSeries, 2>(uri, 1, 2, "ScatterSeries");
221 222 qmlRegisterType<DeclarativeLineSeries, 2>(uri, 1, 2, "LineSeries");
222 223 qmlRegisterType<DeclarativeSplineSeries, 2>(uri, 1, 2, "SplineSeries");
223 224 qmlRegisterType<DeclarativeAreaSeries, 2>(uri, 1, 2, "AreaSeries");
224 225 qmlRegisterType<DeclarativeBarSeries, 2>(uri, 1, 2, "BarSeries");
225 226 qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 1, 2, "StackedBarSeries");
226 227 qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 1, 2, "PercentBarSeries");
227 228 qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 1, 2, "HorizontalBarSeries");
228 229 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 1, 2, "HorizontalStackedBarSeries");
229 230 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 1, 2, "HorizontalPercentBarSeries");
230 231
231 232 // QtCommercial.Chart 1.3
232 233 qmlRegisterType<DeclarativeChart, 3>(uri, 1, 3, "ChartView");
233 234 qmlRegisterType<DeclarativePolarChart, 1>(uri, 1, 3, "PolarChartView");
234 235 qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 1, 3, "SplineSeries");
235 236 qmlRegisterType<DeclarativeScatterSeries, 3>(uri, 1, 3, "ScatterSeries");
236 237 qmlRegisterType<DeclarativeLineSeries, 3>(uri, 1, 3, "LineSeries");
237 238 qmlRegisterType<DeclarativeAreaSeries, 3>(uri, 1, 3, "AreaSeries");
238 239 qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis");
239 240 qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries");
240 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
244 253 QTCOMMERCIALCHART_END_NAMESPACE
245 254
246 255 #include "plugin.moc"
247 256
248 257 QTCOMMERCIALCHART_USE_NAMESPACE
249 258
250 259 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
251 260 Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin))
252 261 #endif
@@ -1,2124 +1,2170
1 1 import QtQuick.tooling 1.1
2 2
3 3 // This file describes the plugin-supplied types contained in the library.
4 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 9 Module {
7 10 Component {
8 11 name: "QGraphicsObject"
9 12 defaultProperty: "children"
10 13 prototype: "QObject"
11 14 Property { name: "parent"; type: "QGraphicsObject"; isPointer: true }
12 15 Property { name: "opacity"; type: "double" }
13 16 Property { name: "enabled"; type: "bool" }
14 17 Property { name: "visible"; type: "bool" }
15 18 Property { name: "pos"; type: "QPointF" }
16 19 Property { name: "x"; type: "double" }
17 20 Property { name: "y"; type: "double" }
18 21 Property { name: "z"; type: "double" }
19 22 Property { name: "rotation"; type: "double" }
20 23 Property { name: "scale"; type: "double" }
21 24 Property { name: "transformOriginPoint"; type: "QPointF" }
22 25 Property { name: "effect"; type: "QGraphicsEffect"; isPointer: true }
23 26 Property {
24 27 name: "children"
25 28 type: "QDeclarativeListProperty<QGraphicsObject>"
26 29 isReadonly: true
27 30 }
28 31 Property { name: "width"; type: "double" }
29 32 Property { name: "height"; type: "double" }
30 33 }
31 34 Component {
32 35 name: "QGraphicsWidget"
33 36 defaultProperty: "children"
34 37 prototype: "QGraphicsObject"
35 38 Property { name: "palette"; type: "QPalette" }
36 39 Property { name: "font"; type: "QFont" }
37 40 Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
38 41 Property { name: "size"; type: "QSizeF" }
39 42 Property { name: "minimumSize"; type: "QSizeF" }
40 43 Property { name: "preferredSize"; type: "QSizeF" }
41 44 Property { name: "maximumSize"; type: "QSizeF" }
42 45 Property { name: "sizePolicy"; type: "QSizePolicy" }
43 46 Property { name: "focusPolicy"; type: "Qt::FocusPolicy" }
44 47 Property { name: "windowFlags"; type: "Qt::WindowFlags" }
45 48 Property { name: "windowTitle"; type: "string" }
46 49 Property { name: "geometry"; type: "QRectF" }
47 50 Property { name: "autoFillBackground"; type: "bool" }
48 51 Property { name: "layout"; type: "QGraphicsLayout"; isPointer: true }
49 52 Method { name: "close"; type: "bool" }
50 53 }
51 54 Component {
52 55 name: "QtCommercialChart::DeclarativeAreaSeries"
53 56 prototype: "QtCommercialChart::QAreaSeries"
54 57 exports: [
55 58 "QtCommercial.Chart/AreaSeries 1.0",
56 59 "QtCommercial.Chart/AreaSeries 1.1",
57 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 65 Property { name: "upperSeries"; type: "DeclarativeLineSeries"; isPointer: true }
62 66 Property { name: "lowerSeries"; type: "DeclarativeLineSeries"; isPointer: true }
63 67 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
64 68 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
65 69 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
66 70 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
67 71 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
68 72 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
69 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 76 Signal {
71 77 name: "axisXChanged"
72 78 revision: 1
73 79 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
74 80 }
75 81 Signal {
76 82 name: "axisYChanged"
77 83 revision: 1
78 84 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
79 85 }
80 86 Signal {
81 87 name: "borderWidthChanged"
82 88 revision: 1
83 89 Parameter { name: "width"; type: "double" }
84 90 }
85 91 Signal {
86 92 name: "axisXTopChanged"
87 93 revision: 2
88 94 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
89 95 }
90 96 Signal {
91 97 name: "axisYRightChanged"
92 98 revision: 2
93 99 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
94 100 }
95 101 Signal {
96 102 name: "axisAngularChanged"
97 103 revision: 3
98 104 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
99 105 }
100 106 Signal {
101 107 name: "axisRadialChanged"
102 108 revision: 3
103 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 118 Component {
107 119 name: "QtCommercialChart::DeclarativeAxes"
108 120 prototype: "QObject"
109 121 exports: ["QtCommercial.Chart/DeclarativeAxes 1.0"]
110 isCreatable: false
111 122 exportMetaObjectRevisions: [0]
112 123 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
113 124 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
114 125 Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
115 126 Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
116 127 Signal {
117 128 name: "axisXChanged"
118 129 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
119 130 }
120 131 Signal {
121 132 name: "axisYChanged"
122 133 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
123 134 }
124 135 Signal {
125 136 name: "axisXTopChanged"
126 137 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
127 138 }
128 139 Signal {
129 140 name: "axisYRightChanged"
130 141 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
131 142 }
132 143 }
133 144 Component {
134 145 name: "QtCommercialChart::DeclarativeBarSeries"
135 146 defaultProperty: "seriesChildren"
136 147 prototype: "QtCommercialChart::QBarSeries"
137 148 exports: [
138 149 "QtCommercial.Chart/BarSeries 1.0",
139 150 "QtCommercial.Chart/BarSeries 1.1",
140 151 "QtCommercial.Chart/BarSeries 1.2"
141 152 ]
142 153 exportMetaObjectRevisions: [0, 1, 2]
143 154 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
144 155 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
145 156 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
146 157 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
147 158 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
148 159 Signal {
149 160 name: "axisXChanged"
150 161 revision: 1
151 162 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
152 163 }
153 164 Signal {
154 165 name: "axisYChanged"
155 166 revision: 1
156 167 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
157 168 }
158 169 Signal {
159 170 name: "axisXTopChanged"
160 171 revision: 2
161 172 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
162 173 }
163 174 Signal {
164 175 name: "axisYRightChanged"
165 176 revision: 2
166 177 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
167 178 }
168 179 Method {
169 180 name: "appendSeriesChildren"
170 181 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
171 182 Parameter { name: "element"; type: "QObject"; isPointer: true }
172 183 }
173 184 Method {
174 185 name: "at"
175 186 type: "DeclarativeBarSet*"
176 187 Parameter { name: "index"; type: "int" }
177 188 }
178 189 Method {
179 190 name: "append"
180 191 type: "DeclarativeBarSet*"
181 192 Parameter { name: "label"; type: "string" }
182 193 Parameter { name: "values"; type: "QVariantList" }
183 194 }
184 195 Method {
185 196 name: "insert"
186 197 type: "DeclarativeBarSet*"
187 198 Parameter { name: "index"; type: "int" }
188 199 Parameter { name: "label"; type: "string" }
189 200 Parameter { name: "values"; type: "QVariantList" }
190 201 }
191 202 Method {
192 203 name: "remove"
193 204 type: "bool"
194 205 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
195 206 }
196 207 Method { name: "clear" }
197 208 }
198 209 Component {
199 210 name: "QtCommercialChart::DeclarativeBarSet"
200 211 prototype: "QtCommercialChart::QBarSet"
201 212 exports: [
202 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 218 Property { name: "values"; type: "QVariantList" }
207 219 Property { name: "borderWidth"; revision: 1; type: "double" }
208 220 Property { name: "count"; type: "int"; isReadonly: true }
221 Property { name: "brushFilename"; revision: 2; type: "string" }
209 222 Signal {
210 223 name: "countChanged"
211 224 Parameter { name: "count"; type: "int" }
212 225 }
213 226 Signal {
214 227 name: "borderWidthChanged"
215 228 revision: 1
216 229 Parameter { name: "width"; type: "double" }
217 230 }
231 Signal {
232 name: "brushFilenameChanged"
233 revision: 2
234 Parameter { name: "brushFilename"; type: "string" }
235 }
218 236 Method {
219 237 name: "append"
220 238 Parameter { name: "value"; type: "double" }
221 239 }
222 240 Method {
223 241 name: "remove"
224 242 Parameter { name: "index"; type: "int" }
225 243 Parameter { name: "count"; type: "int" }
226 244 }
227 245 Method {
228 246 name: "remove"
229 247 Parameter { name: "index"; type: "int" }
230 248 }
231 249 Method {
232 250 name: "replace"
233 251 Parameter { name: "index"; type: "int" }
234 252 Parameter { name: "value"; type: "double" }
235 253 }
236 254 Method {
237 255 name: "at"
238 256 type: "double"
239 257 Parameter { name: "index"; type: "int" }
240 258 }
241 259 }
242 260 Component {
243 261 name: "QtCommercialChart::DeclarativeBoxPlotSeries"
244 262 defaultProperty: "seriesChildren"
245 263 prototype: "QtCommercialChart::QBoxPlotSeries"
246 exports: ["QtCommercial.Chart/BoxPlotSeries 1.3"]
247 exportMetaObjectRevisions: [0]
264 exports: [
265 "QtCommercial.Chart/BoxPlotSeries 1.3",
266 "QtCommercial.Chart/BoxPlotSeries 1.4"
267 ]
268 exportMetaObjectRevisions: [0, 1]
248 269 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
249 270 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
250 271 Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
251 272 Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
252 273 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
274 Property { name: "brushFilename"; revision: 1; type: "string" }
253 275 Signal {
254 276 name: "axisXChanged"
255 277 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
256 278 }
257 279 Signal {
258 280 name: "axisYChanged"
259 281 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
260 282 }
261 283 Signal {
262 284 name: "axisXTopChanged"
263 285 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
264 286 }
265 287 Signal {
266 288 name: "axisYRightChanged"
267 289 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
268 290 }
269 291 Signal {
270 292 name: "clicked"
271 293 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
272 294 }
273 295 Signal {
274 296 name: "hovered"
275 297 Parameter { name: "status"; type: "bool" }
276 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 305 Method {
279 306 name: "appendSeriesChildren"
280 307 Parameter { name: "list"; type: "QDECLARATIVE_LIST_PROPERTY<QObject>"; isPointer: true }
281 308 Parameter { name: "element"; type: "QObject"; isPointer: true }
282 309 }
283 310 Method {
284 311 name: "onHovered"
285 312 Parameter { name: "status"; type: "bool" }
286 313 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
287 314 }
288 315 Method {
289 316 name: "onClicked"
290 317 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
291 318 }
292 319 Method {
293 320 name: "at"
294 321 type: "DeclarativeBoxSet*"
295 322 Parameter { name: "index"; type: "int" }
296 323 }
297 324 Method {
298 325 name: "append"
299 326 type: "DeclarativeBoxSet*"
300 327 Parameter { name: "label"; type: "string" }
301 328 Parameter { name: "values"; type: "QVariantList" }
302 329 }
303 330 Method {
304 331 name: "append"
305 332 Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
306 333 }
307 334 Method {
308 335 name: "insert"
309 336 type: "DeclarativeBoxSet*"
310 337 Parameter { name: "index"; type: "int" }
311 338 Parameter { name: "label"; type: "string" }
312 339 Parameter { name: "values"; type: "QVariantList" }
313 340 }
314 341 Method {
315 342 name: "remove"
316 343 type: "bool"
317 344 Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
318 345 }
319 346 Method { name: "clear" }
320 347 }
321 348 Component {
322 349 name: "QtCommercialChart::DeclarativeBoxSet"
323 350 prototype: "QtCommercialChart::QBoxSet"
324 exports: ["QtCommercial.Chart/BoxSet 1.3"]
325 exportMetaObjectRevisions: [0]
351 exports: [
352 "QtCommercial.Chart/BoxSet 1.3",
353 "QtCommercial.Chart/BoxSet 1.4"
354 ]
355 exportMetaObjectRevisions: [0, 1]
326 356 Enum {
327 357 name: "ValuePositions"
328 358 values: {
329 359 "LowerExtreme": 0,
330 360 "LowerQuartile": 1,
331 361 "Median": 2,
332 362 "UpperQuartile": 3,
333 363 "UpperExtreme": 4
334 364 }
335 365 }
336 366 Property { name: "values"; type: "QVariantList" }
337 367 Property { name: "label"; type: "string" }
338 368 Property { name: "count"; type: "int"; isReadonly: true }
369 Property { name: "brushFilename"; revision: 1; type: "string" }
339 370 Signal { name: "changedValues" }
340 371 Signal {
341 372 name: "changedValue"
342 373 Parameter { name: "index"; type: "int" }
343 374 }
375 Signal {
376 name: "brushFilenameChanged"
377 revision: 1
378 Parameter { name: "brushFilename"; type: "string" }
379 }
344 380 Method {
345 381 name: "append"
346 382 Parameter { name: "value"; type: "double" }
347 383 }
348 384 Method { name: "clear" }
349 385 Method {
350 386 name: "at"
351 387 type: "double"
352 388 Parameter { name: "index"; type: "int" }
353 389 }
354 390 Method {
355 391 name: "setValue"
356 392 Parameter { name: "index"; type: "int" }
357 393 Parameter { name: "value"; type: "double" }
358 394 }
359 395 }
360 396 Component {
361 397 name: "QtCommercialChart::DeclarativeCategoryAxis"
362 398 defaultProperty: "axisChildren"
363 399 prototype: "QtCommercialChart::QCategoryAxis"
364 400 exports: ["QtCommercial.Chart/CategoryAxis 1.1"]
365 401 exportMetaObjectRevisions: [0]
366 402 Property { name: "axisChildren"; type: "QObject"; isList: true; isReadonly: true }
367 403 Method {
368 404 name: "append"
369 405 Parameter { name: "label"; type: "string" }
370 406 Parameter { name: "categoryEndValue"; type: "double" }
371 407 }
372 408 Method {
373 409 name: "remove"
374 410 Parameter { name: "label"; type: "string" }
375 411 }
376 412 Method {
377 413 name: "replace"
378 414 Parameter { name: "oldLabel"; type: "string" }
379 415 Parameter { name: "newLabel"; type: "string" }
380 416 }
381 417 Method {
382 418 name: "appendAxisChildren"
383 419 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
384 420 Parameter { name: "element"; type: "QObject"; isPointer: true }
385 421 }
386 422 }
387 423 Component {
388 424 name: "QtCommercialChart::DeclarativeCategoryRange"
389 425 prototype: "QObject"
390 426 exports: ["QtCommercial.Chart/CategoryRange 1.1"]
391 427 exportMetaObjectRevisions: [0]
392 428 Property { name: "endValue"; type: "double" }
393 429 Property { name: "label"; type: "string" }
394 430 }
395 431 Component {
396 432 name: "QtCommercialChart::DeclarativeChart"
397 433 defaultProperty: "data"
398 434 prototype: "QQuickPaintedItem"
399 435 exports: [
400 436 "QtCommercial.Chart/ChartView 1.0",
401 437 "QtCommercial.Chart/ChartView 1.1",
402 438 "QtCommercial.Chart/ChartView 1.2",
403 439 "QtCommercial.Chart/ChartView 1.3"
404 440 ]
405 441 exportMetaObjectRevisions: [0, 1, 2, 3]
406 442 Enum {
407 443 name: "Theme"
408 444 values: {
409 445 "ChartThemeLight": 0,
410 446 "ChartThemeBlueCerulean": 1,
411 447 "ChartThemeDark": 2,
412 448 "ChartThemeBrownSand": 3,
413 449 "ChartThemeBlueNcs": 4,
414 450 "ChartThemeHighContrast": 5,
415 451 "ChartThemeBlueIcy": 6,
416 452 "ChartThemeQt": 7
417 453 }
418 454 }
419 455 Enum {
420 456 name: "Animation"
421 457 values: {
422 458 "NoAnimation": 0,
423 459 "GridAxisAnimations": 1,
424 460 "SeriesAnimations": 2,
425 461 "AllAnimations": 3
426 462 }
427 463 }
428 464 Enum {
429 465 name: "SeriesType"
430 466 values: {
431 467 "SeriesTypeLine": 0,
432 468 "SeriesTypeArea": 1,
433 469 "SeriesTypeBar": 2,
434 470 "SeriesTypeStackedBar": 3,
435 471 "SeriesTypePercentBar": 4,
436 472 "SeriesTypeBoxPlot": 5,
437 473 "SeriesTypePie": 6,
438 474 "SeriesTypeScatter": 7,
439 475 "SeriesTypeSpline": 8,
440 476 "SeriesTypeHorizontalBar": 9,
441 477 "SeriesTypeHorizontalStackedBar": 10,
442 478 "SeriesTypeHorizontalPercentBar": 11
443 479 }
444 480 }
445 481 Property { name: "theme"; type: "Theme" }
446 482 Property { name: "animationOptions"; type: "Animation" }
447 483 Property { name: "title"; type: "string" }
448 484 Property { name: "titleFont"; type: "QFont" }
449 485 Property { name: "titleColor"; type: "QColor" }
450 486 Property { name: "legend"; type: "QLegend"; isReadonly: true; isPointer: true }
451 487 Property { name: "count"; type: "int"; isReadonly: true }
452 488 Property { name: "backgroundColor"; type: "QColor" }
453 489 Property { name: "dropShadowEnabled"; type: "bool" }
454 490 Property { name: "backgroundRoundness"; revision: 3; type: "double" }
455 491 Property { name: "topMargin"; type: "double"; isReadonly: true }
456 492 Property { name: "bottomMargin"; type: "double"; isReadonly: true }
457 493 Property { name: "leftMargin"; type: "double"; isReadonly: true }
458 494 Property { name: "rightMargin"; type: "double"; isReadonly: true }
459 495 Property {
460 496 name: "minimumMargins"
461 497 revision: 1
462 498 type: "DeclarativeMargins"
463 499 isReadonly: true
464 500 isPointer: true
465 501 }
466 502 Property {
467 503 name: "margins"
468 504 revision: 2
469 505 type: "DeclarativeMargins"
470 506 isReadonly: true
471 507 isPointer: true
472 508 }
473 509 Property { name: "plotArea"; revision: 1; type: "QRectF"; isReadonly: true }
474 510 Property { name: "plotAreaColor"; revision: 3; type: "QColor" }
475 511 Property { name: "axes"; revision: 2; type: "QAbstractAxis"; isList: true; isReadonly: true }
476 512 Signal { name: "axisLabelsChanged" }
477 513 Signal {
478 514 name: "titleColorChanged"
479 515 Parameter { name: "color"; type: "QColor" }
480 516 }
481 517 Signal {
482 518 name: "dropShadowEnabledChanged"
483 519 Parameter { name: "enabled"; type: "bool" }
484 520 }
485 521 Signal { name: "marginsChanged"; revision: 2 }
486 522 Signal {
487 523 name: "plotAreaChanged"
488 524 Parameter { name: "plotArea"; type: "QRectF" }
489 525 }
490 526 Signal {
491 527 name: "seriesAdded"
492 528 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
493 529 }
494 530 Signal {
495 531 name: "seriesRemoved"
496 532 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
497 533 }
498 534 Signal { name: "plotAreaColorChanged"; revision: 3 }
499 535 Signal {
500 536 name: "backgroundRoundnessChanged"
501 537 revision: 3
502 538 Parameter { name: "diameter"; type: "double" }
503 539 }
504 540 Method {
505 541 name: "series"
506 542 type: "QAbstractSeries*"
507 543 Parameter { name: "index"; type: "int" }
508 544 }
509 545 Method {
510 546 name: "series"
511 547 type: "QAbstractSeries*"
512 548 Parameter { name: "seriesName"; type: "string" }
513 549 }
514 550 Method {
515 551 name: "createSeries"
516 552 type: "QAbstractSeries*"
517 553 Parameter { name: "type"; type: "int" }
518 554 Parameter { name: "name"; type: "string" }
519 555 Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
520 556 Parameter { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
521 557 }
522 558 Method {
523 559 name: "createSeries"
524 560 type: "QAbstractSeries*"
525 561 Parameter { name: "type"; type: "int" }
526 562 Parameter { name: "name"; type: "string" }
527 563 Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
528 564 }
529 565 Method {
530 566 name: "createSeries"
531 567 type: "QAbstractSeries*"
532 568 Parameter { name: "type"; type: "int" }
533 569 Parameter { name: "name"; type: "string" }
534 570 }
535 571 Method {
536 572 name: "createSeries"
537 573 type: "QAbstractSeries*"
538 574 Parameter { name: "type"; type: "int" }
539 575 }
540 576 Method {
541 577 name: "removeSeries"
542 578 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
543 579 }
544 580 Method { name: "removeAllSeries" }
545 581 Method {
546 582 name: "setAxisX"
547 583 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
548 584 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
549 585 }
550 586 Method {
551 587 name: "setAxisX"
552 588 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
553 589 }
554 590 Method {
555 591 name: "setAxisY"
556 592 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
557 593 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
558 594 }
559 595 Method {
560 596 name: "setAxisY"
561 597 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
562 598 }
563 599 Method { name: "createDefaultAxes" }
564 600 Method {
565 601 name: "axisX"
566 602 type: "QAbstractAxis*"
567 603 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
568 604 }
569 605 Method { name: "axisX"; type: "QAbstractAxis*" }
570 606 Method {
571 607 name: "axisY"
572 608 type: "QAbstractAxis*"
573 609 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
574 610 }
575 611 Method { name: "axisY"; type: "QAbstractAxis*" }
576 612 Method {
577 613 name: "zoom"
578 614 Parameter { name: "factor"; type: "double" }
579 615 }
580 616 Method {
581 617 name: "scrollLeft"
582 618 Parameter { name: "pixels"; type: "double" }
583 619 }
584 620 Method {
585 621 name: "scrollRight"
586 622 Parameter { name: "pixels"; type: "double" }
587 623 }
588 624 Method {
589 625 name: "scrollUp"
590 626 Parameter { name: "pixels"; type: "double" }
591 627 }
592 628 Method {
593 629 name: "scrollDown"
594 630 Parameter { name: "pixels"; type: "double" }
595 631 }
596 632 }
597 633 Component {
598 634 name: "QtCommercialChart::DeclarativeHorizontalBarSeries"
599 635 defaultProperty: "seriesChildren"
600 636 prototype: "QtCommercialChart::QHorizontalBarSeries"
601 637 exports: [
602 638 "QtCommercial.Chart/HorizontalBarSeries 1.1",
603 639 "QtCommercial.Chart/HorizontalBarSeries 1.2"
604 640 ]
605 641 exportMetaObjectRevisions: [1, 2]
606 642 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
607 643 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
608 644 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
609 645 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
610 646 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
611 647 Signal {
612 648 name: "axisXChanged"
613 649 revision: 1
614 650 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
615 651 }
616 652 Signal {
617 653 name: "axisYChanged"
618 654 revision: 1
619 655 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
620 656 }
621 657 Signal {
622 658 name: "axisXTopChanged"
623 659 revision: 2
624 660 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
625 661 }
626 662 Signal {
627 663 name: "axisYRightChanged"
628 664 revision: 2
629 665 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
630 666 }
631 667 Method {
632 668 name: "appendSeriesChildren"
633 669 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
634 670 Parameter { name: "element"; type: "QObject"; isPointer: true }
635 671 }
636 672 Method {
637 673 name: "at"
638 674 type: "DeclarativeBarSet*"
639 675 Parameter { name: "index"; type: "int" }
640 676 }
641 677 Method {
642 678 name: "append"
643 679 type: "DeclarativeBarSet*"
644 680 Parameter { name: "label"; type: "string" }
645 681 Parameter { name: "values"; type: "QVariantList" }
646 682 }
647 683 Method {
648 684 name: "insert"
649 685 type: "DeclarativeBarSet*"
650 686 Parameter { name: "index"; type: "int" }
651 687 Parameter { name: "label"; type: "string" }
652 688 Parameter { name: "values"; type: "QVariantList" }
653 689 }
654 690 Method {
655 691 name: "remove"
656 692 type: "bool"
657 693 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
658 694 }
659 695 Method { name: "clear" }
660 696 }
661 697 Component {
662 698 name: "QtCommercialChart::DeclarativeHorizontalPercentBarSeries"
663 699 defaultProperty: "seriesChildren"
664 700 prototype: "QtCommercialChart::QHorizontalPercentBarSeries"
665 701 exports: [
666 702 "QtCommercial.Chart/HorizontalPercentBarSeries 1.1",
667 703 "QtCommercial.Chart/HorizontalPercentBarSeries 1.2"
668 704 ]
669 705 exportMetaObjectRevisions: [1, 2]
670 706 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
671 707 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
672 708 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
673 709 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
674 710 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
675 711 Signal {
676 712 name: "axisXChanged"
677 713 revision: 1
678 714 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
679 715 }
680 716 Signal {
681 717 name: "axisYChanged"
682 718 revision: 1
683 719 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
684 720 }
685 721 Signal {
686 722 name: "axisXTopChanged"
687 723 revision: 2
688 724 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
689 725 }
690 726 Signal {
691 727 name: "axisYRightChanged"
692 728 revision: 2
693 729 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
694 730 }
695 731 Method {
696 732 name: "appendSeriesChildren"
697 733 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
698 734 Parameter { name: "element"; type: "QObject"; isPointer: true }
699 735 }
700 736 Method {
701 737 name: "at"
702 738 type: "DeclarativeBarSet*"
703 739 Parameter { name: "index"; type: "int" }
704 740 }
705 741 Method {
706 742 name: "append"
707 743 type: "DeclarativeBarSet*"
708 744 Parameter { name: "label"; type: "string" }
709 745 Parameter { name: "values"; type: "QVariantList" }
710 746 }
711 747 Method {
712 748 name: "insert"
713 749 type: "DeclarativeBarSet*"
714 750 Parameter { name: "index"; type: "int" }
715 751 Parameter { name: "label"; type: "string" }
716 752 Parameter { name: "values"; type: "QVariantList" }
717 753 }
718 754 Method {
719 755 name: "remove"
720 756 type: "bool"
721 757 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
722 758 }
723 759 Method { name: "clear" }
724 760 }
725 761 Component {
726 762 name: "QtCommercialChart::DeclarativeHorizontalStackedBarSeries"
727 763 defaultProperty: "seriesChildren"
728 764 prototype: "QtCommercialChart::QHorizontalStackedBarSeries"
729 765 exports: [
730 766 "QtCommercial.Chart/HorizontalStackedBarSeries 1.1",
731 767 "QtCommercial.Chart/HorizontalStackedBarSeries 1.2"
732 768 ]
733 769 exportMetaObjectRevisions: [1, 2]
734 770 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
735 771 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
736 772 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
737 773 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
738 774 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
739 775 Signal {
740 776 name: "axisXChanged"
741 777 revision: 1
742 778 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
743 779 }
744 780 Signal {
745 781 name: "axisYChanged"
746 782 revision: 1
747 783 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
748 784 }
749 785 Signal {
750 786 name: "axisXTopChanged"
751 787 revision: 2
752 788 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
753 789 }
754 790 Signal {
755 791 name: "axisYRightChanged"
756 792 revision: 2
757 793 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
758 794 }
759 795 Method {
760 796 name: "appendSeriesChildren"
761 797 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
762 798 Parameter { name: "element"; type: "QObject"; isPointer: true }
763 799 }
764 800 Method {
765 801 name: "at"
766 802 type: "DeclarativeBarSet*"
767 803 Parameter { name: "index"; type: "int" }
768 804 }
769 805 Method {
770 806 name: "append"
771 807 type: "DeclarativeBarSet*"
772 808 Parameter { name: "label"; type: "string" }
773 809 Parameter { name: "values"; type: "QVariantList" }
774 810 }
775 811 Method {
776 812 name: "insert"
777 813 type: "DeclarativeBarSet*"
778 814 Parameter { name: "index"; type: "int" }
779 815 Parameter { name: "label"; type: "string" }
780 816 Parameter { name: "values"; type: "QVariantList" }
781 817 }
782 818 Method {
783 819 name: "remove"
784 820 type: "bool"
785 821 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
786 822 }
787 823 Method { name: "clear" }
788 824 }
789 825 Component {
790 826 name: "QtCommercialChart::DeclarativeLineSeries"
791 827 defaultProperty: "declarativeChildren"
792 828 prototype: "QtCommercialChart::QLineSeries"
793 829 exports: [
794 830 "QtCommercial.Chart/LineSeries 1.0",
795 831 "QtCommercial.Chart/LineSeries 1.1",
796 832 "QtCommercial.Chart/LineSeries 1.2",
797 833 "QtCommercial.Chart/LineSeries 1.3"
798 834 ]
799 835 exportMetaObjectRevisions: [0, 1, 2, 3]
800 836 Property { name: "count"; type: "int"; isReadonly: true }
801 837 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
802 838 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
803 839 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
804 840 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
805 841 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
806 842 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
807 843 Property { name: "width"; revision: 1; type: "double" }
808 844 Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
809 845 Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
810 846 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
811 847 Signal {
812 848 name: "countChanged"
813 849 Parameter { name: "count"; type: "int" }
814 850 }
815 851 Signal {
816 852 name: "axisXChanged"
817 853 revision: 1
818 854 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
819 855 }
820 856 Signal {
821 857 name: "axisYChanged"
822 858 revision: 1
823 859 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
824 860 }
825 861 Signal {
826 862 name: "axisXTopChanged"
827 863 revision: 2
828 864 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
829 865 }
830 866 Signal {
831 867 name: "axisYRightChanged"
832 868 revision: 2
833 869 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
834 870 }
835 871 Signal {
836 872 name: "axisAngularChanged"
837 873 revision: 3
838 874 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
839 875 }
840 876 Signal {
841 877 name: "axisRadialChanged"
842 878 revision: 3
843 879 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
844 880 }
845 881 Signal {
846 882 name: "widthChanged"
847 883 revision: 1
848 884 Parameter { name: "width"; type: "double" }
849 885 }
850 886 Signal {
851 887 name: "styleChanged"
852 888 revision: 1
853 889 Parameter { name: "style"; type: "Qt::PenStyle" }
854 890 }
855 891 Signal {
856 892 name: "capStyleChanged"
857 893 revision: 1
858 894 Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
859 895 }
860 896 Method {
861 897 name: "appendDeclarativeChildren"
862 898 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
863 899 Parameter { name: "element"; type: "QObject"; isPointer: true }
864 900 }
865 901 Method {
866 902 name: "handleCountChanged"
867 903 Parameter { name: "index"; type: "int" }
868 904 }
869 905 Method {
870 906 name: "append"
871 907 Parameter { name: "x"; type: "double" }
872 908 Parameter { name: "y"; type: "double" }
873 909 }
874 910 Method {
875 911 name: "replace"
876 912 Parameter { name: "oldX"; type: "double" }
877 913 Parameter { name: "oldY"; type: "double" }
878 914 Parameter { name: "newX"; type: "double" }
879 915 Parameter { name: "newY"; type: "double" }
880 916 }
881 917 Method {
882 918 name: "replace"
883 919 revision: 3
884 920 Parameter { name: "index"; type: "int" }
885 921 Parameter { name: "newX"; type: "double" }
886 922 Parameter { name: "newY"; type: "double" }
887 923 }
888 924 Method {
889 925 name: "remove"
890 926 Parameter { name: "x"; type: "double" }
891 927 Parameter { name: "y"; type: "double" }
892 928 }
893 929 Method {
894 930 name: "remove"
895 931 revision: 3
896 932 Parameter { name: "index"; type: "int" }
897 933 }
898 934 Method {
899 935 name: "insert"
900 936 Parameter { name: "index"; type: "int" }
901 937 Parameter { name: "x"; type: "double" }
902 938 Parameter { name: "y"; type: "double" }
903 939 }
904 940 Method { name: "clear" }
905 941 Method {
906 942 name: "at"
907 943 type: "QPointF"
908 944 Parameter { name: "index"; type: "int" }
909 945 }
910 946 }
911 947 Component {
912 948 name: "QtCommercialChart::DeclarativeMargins"
913 949 prototype: "QObject"
914 950 exports: ["QtCommercial.Chart/Margins 1.1"]
915 isCreatable: false
916 951 exportMetaObjectRevisions: [0]
917 952 Property { name: "top"; type: "int" }
918 953 Property { name: "bottom"; type: "int" }
919 954 Property { name: "left"; type: "int" }
920 955 Property { name: "right"; type: "int" }
921 956 Signal {
922 957 name: "topChanged"
923 958 Parameter { name: "top"; type: "int" }
924 959 Parameter { name: "bottom"; type: "int" }
925 960 Parameter { name: "left"; type: "int" }
926 961 Parameter { name: "right"; type: "int" }
927 962 }
928 963 Signal {
929 964 name: "bottomChanged"
930 965 Parameter { name: "top"; type: "int" }
931 966 Parameter { name: "bottom"; type: "int" }
932 967 Parameter { name: "left"; type: "int" }
933 968 Parameter { name: "right"; type: "int" }
934 969 }
935 970 Signal {
936 971 name: "leftChanged"
937 972 Parameter { name: "top"; type: "int" }
938 973 Parameter { name: "bottom"; type: "int" }
939 974 Parameter { name: "left"; type: "int" }
940 975 Parameter { name: "right"; type: "int" }
941 976 }
942 977 Signal {
943 978 name: "rightChanged"
944 979 Parameter { name: "top"; type: "int" }
945 980 Parameter { name: "bottom"; type: "int" }
946 981 Parameter { name: "left"; type: "int" }
947 982 Parameter { name: "right"; type: "int" }
948 983 }
949 984 }
950 985 Component {
951 986 name: "QtCommercialChart::DeclarativePercentBarSeries"
952 987 defaultProperty: "seriesChildren"
953 988 prototype: "QtCommercialChart::QPercentBarSeries"
954 989 exports: [
955 990 "QtCommercial.Chart/PercentBarSeries 1.0",
956 991 "QtCommercial.Chart/PercentBarSeries 1.1",
957 992 "QtCommercial.Chart/PercentBarSeries 1.2"
958 993 ]
959 994 exportMetaObjectRevisions: [0, 1, 2]
960 995 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
961 996 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
962 997 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
963 998 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
964 999 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
965 1000 Signal {
966 1001 name: "axisXChanged"
967 1002 revision: 1
968 1003 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
969 1004 }
970 1005 Signal {
971 1006 name: "axisYChanged"
972 1007 revision: 1
973 1008 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
974 1009 }
975 1010 Signal {
976 1011 name: "axisXTopChanged"
977 1012 revision: 2
978 1013 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
979 1014 }
980 1015 Signal {
981 1016 name: "axisYRightChanged"
982 1017 revision: 2
983 1018 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
984 1019 }
985 1020 Method {
986 1021 name: "appendSeriesChildren"
987 1022 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
988 1023 Parameter { name: "element"; type: "QObject"; isPointer: true }
989 1024 }
990 1025 Method {
991 1026 name: "at"
992 1027 type: "DeclarativeBarSet*"
993 1028 Parameter { name: "index"; type: "int" }
994 1029 }
995 1030 Method {
996 1031 name: "append"
997 1032 type: "DeclarativeBarSet*"
998 1033 Parameter { name: "label"; type: "string" }
999 1034 Parameter { name: "values"; type: "QVariantList" }
1000 1035 }
1001 1036 Method {
1002 1037 name: "insert"
1003 1038 type: "DeclarativeBarSet*"
1004 1039 Parameter { name: "index"; type: "int" }
1005 1040 Parameter { name: "label"; type: "string" }
1006 1041 Parameter { name: "values"; type: "QVariantList" }
1007 1042 }
1008 1043 Method {
1009 1044 name: "remove"
1010 1045 type: "bool"
1011 1046 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1012 1047 }
1013 1048 Method { name: "clear" }
1014 1049 }
1015 1050 Component {
1016 1051 name: "QtCommercialChart::DeclarativePieSeries"
1017 1052 defaultProperty: "seriesChildren"
1018 1053 prototype: "QtCommercialChart::QPieSeries"
1019 1054 exports: [
1020 1055 "QtCommercial.Chart/PieSeries 1.0",
1021 1056 "QtCommercial.Chart/PieSeries 1.1"
1022 1057 ]
1023 1058 exportMetaObjectRevisions: [0, 0]
1024 1059 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
1025 1060 Signal {
1026 1061 name: "sliceAdded"
1027 1062 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1028 1063 }
1029 1064 Signal {
1030 1065 name: "sliceRemoved"
1031 1066 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1032 1067 }
1033 1068 Method {
1034 1069 name: "appendSeriesChildren"
1035 1070 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1036 1071 Parameter { name: "element"; type: "QObject"; isPointer: true }
1037 1072 }
1038 1073 Method {
1039 1074 name: "handleAdded"
1040 1075 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
1041 1076 }
1042 1077 Method {
1043 1078 name: "handleRemoved"
1044 1079 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
1045 1080 }
1046 1081 Method {
1047 1082 name: "at"
1048 1083 type: "QPieSlice*"
1049 1084 Parameter { name: "index"; type: "int" }
1050 1085 }
1051 1086 Method {
1052 1087 name: "find"
1053 1088 type: "QPieSlice*"
1054 1089 Parameter { name: "label"; type: "string" }
1055 1090 }
1056 1091 Method {
1057 1092 name: "append"
1058 type: "QPieSlice*"
1093 type: "DeclarativePieSlice*"
1059 1094 Parameter { name: "label"; type: "string" }
1060 1095 Parameter { name: "value"; type: "double" }
1061 1096 }
1062 1097 Method {
1063 1098 name: "remove"
1064 1099 type: "bool"
1065 1100 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1066 1101 }
1067 1102 Method { name: "clear" }
1068 1103 }
1069 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 1116 name: "QtCommercialChart::DeclarativePolarChart"
1071 1117 defaultProperty: "data"
1072 1118 prototype: "QtCommercialChart::DeclarativeChart"
1073 1119 exports: ["QtCommercial.Chart/PolarChartView 1.3"]
1074 1120 exportMetaObjectRevisions: [1]
1075 1121 }
1076 1122 Component {
1077 1123 name: "QtCommercialChart::DeclarativeScatterSeries"
1078 1124 defaultProperty: "declarativeChildren"
1079 1125 prototype: "QtCommercialChart::QScatterSeries"
1080 1126 exports: [
1081 1127 "QtCommercial.Chart/ScatterSeries 1.0",
1082 1128 "QtCommercial.Chart/ScatterSeries 1.1",
1083 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 1134 Property { name: "count"; type: "int"; isReadonly: true }
1088 1135 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1089 1136 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1090 1137 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1091 1138 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1092 1139 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1093 1140 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1094 1141 Property { name: "borderWidth"; revision: 1; type: "double" }
1095 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 1145 Signal {
1097 1146 name: "countChanged"
1098 1147 Parameter { name: "count"; type: "int" }
1099 1148 }
1100 1149 Signal {
1101 1150 name: "axisXChanged"
1102 1151 revision: 1
1103 1152 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1104 1153 }
1105 1154 Signal {
1106 1155 name: "axisYChanged"
1107 1156 revision: 1
1108 1157 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1109 1158 }
1110 1159 Signal {
1111 1160 name: "borderWidthChanged"
1112 1161 revision: 1
1113 1162 Parameter { name: "width"; type: "double" }
1114 1163 }
1115 1164 Signal {
1116 1165 name: "axisXTopChanged"
1117 1166 revision: 2
1118 1167 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1119 1168 }
1120 1169 Signal {
1121 1170 name: "axisYRightChanged"
1122 1171 revision: 2
1123 1172 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1124 1173 }
1125 1174 Signal {
1126 1175 name: "axisAngularChanged"
1127 1176 revision: 3
1128 1177 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1129 1178 }
1130 1179 Signal {
1131 1180 name: "axisRadialChanged"
1132 1181 revision: 3
1133 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 1190 Method {
1136 1191 name: "appendDeclarativeChildren"
1137 1192 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1138 1193 Parameter { name: "element"; type: "QObject"; isPointer: true }
1139 1194 }
1140 1195 Method {
1141 1196 name: "handleCountChanged"
1142 1197 Parameter { name: "index"; type: "int" }
1143 1198 }
1144 1199 Method {
1145 1200 name: "append"
1146 1201 Parameter { name: "x"; type: "double" }
1147 1202 Parameter { name: "y"; type: "double" }
1148 1203 }
1149 1204 Method {
1150 1205 name: "replace"
1151 1206 Parameter { name: "oldX"; type: "double" }
1152 1207 Parameter { name: "oldY"; type: "double" }
1153 1208 Parameter { name: "newX"; type: "double" }
1154 1209 Parameter { name: "newY"; type: "double" }
1155 1210 }
1156 1211 Method {
1157 1212 name: "replace"
1158 1213 revision: 3
1159 1214 Parameter { name: "index"; type: "int" }
1160 1215 Parameter { name: "newX"; type: "double" }
1161 1216 Parameter { name: "newY"; type: "double" }
1162 1217 }
1163 1218 Method {
1164 1219 name: "remove"
1165 1220 Parameter { name: "x"; type: "double" }
1166 1221 Parameter { name: "y"; type: "double" }
1167 1222 }
1168 1223 Method {
1169 1224 name: "remove"
1170 1225 revision: 3
1171 1226 Parameter { name: "index"; type: "int" }
1172 1227 }
1173 1228 Method {
1174 1229 name: "insert"
1175 1230 Parameter { name: "index"; type: "int" }
1176 1231 Parameter { name: "x"; type: "double" }
1177 1232 Parameter { name: "y"; type: "double" }
1178 1233 }
1179 1234 Method { name: "clear" }
1180 1235 Method {
1181 1236 name: "at"
1182 1237 type: "QPointF"
1183 1238 Parameter { name: "index"; type: "int" }
1184 1239 }
1185 1240 }
1186 1241 Component {
1187 1242 name: "QtCommercialChart::DeclarativeSplineSeries"
1188 1243 defaultProperty: "declarativeChildren"
1189 1244 prototype: "QtCommercialChart::QSplineSeries"
1190 1245 exports: [
1191 1246 "QtCommercial.Chart/SplineSeries 1.0",
1192 1247 "QtCommercial.Chart/SplineSeries 1.1",
1193 1248 "QtCommercial.Chart/SplineSeries 1.2",
1194 1249 "QtCommercial.Chart/SplineSeries 1.3"
1195 1250 ]
1196 1251 exportMetaObjectRevisions: [0, 1, 2, 3]
1197 1252 Property { name: "count"; type: "int"; isReadonly: true }
1198 1253 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1199 1254 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1200 1255 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1201 1256 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1202 1257 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1203 1258 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1204 1259 Property { name: "width"; revision: 1; type: "double" }
1205 1260 Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
1206 1261 Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
1207 1262 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
1208 1263 Signal {
1209 1264 name: "countChanged"
1210 1265 Parameter { name: "count"; type: "int" }
1211 1266 }
1212 1267 Signal {
1213 1268 name: "axisXChanged"
1214 1269 revision: 1
1215 1270 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1216 1271 }
1217 1272 Signal {
1218 1273 name: "axisYChanged"
1219 1274 revision: 1
1220 1275 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1221 1276 }
1222 1277 Signal {
1223 1278 name: "axisXTopChanged"
1224 1279 revision: 2
1225 1280 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1226 1281 }
1227 1282 Signal {
1228 1283 name: "axisYRightChanged"
1229 1284 revision: 2
1230 1285 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1231 1286 }
1232 1287 Signal {
1233 1288 name: "axisAngularChanged"
1234 1289 revision: 3
1235 1290 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1236 1291 }
1237 1292 Signal {
1238 1293 name: "axisRadialChanged"
1239 1294 revision: 3
1240 1295 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1241 1296 }
1242 1297 Signal {
1243 1298 name: "widthChanged"
1244 1299 revision: 1
1245 1300 Parameter { name: "width"; type: "double" }
1246 1301 }
1247 1302 Signal {
1248 1303 name: "styleChanged"
1249 1304 revision: 1
1250 1305 Parameter { name: "style"; type: "Qt::PenStyle" }
1251 1306 }
1252 1307 Signal {
1253 1308 name: "capStyleChanged"
1254 1309 revision: 1
1255 1310 Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
1256 1311 }
1257 1312 Method {
1258 1313 name: "appendDeclarativeChildren"
1259 1314 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1260 1315 Parameter { name: "element"; type: "QObject"; isPointer: true }
1261 1316 }
1262 1317 Method {
1263 1318 name: "handleCountChanged"
1264 1319 Parameter { name: "index"; type: "int" }
1265 1320 }
1266 1321 Method {
1267 1322 name: "append"
1268 1323 Parameter { name: "x"; type: "double" }
1269 1324 Parameter { name: "y"; type: "double" }
1270 1325 }
1271 1326 Method {
1272 1327 name: "replace"
1273 1328 Parameter { name: "oldX"; type: "double" }
1274 1329 Parameter { name: "oldY"; type: "double" }
1275 1330 Parameter { name: "newX"; type: "double" }
1276 1331 Parameter { name: "newY"; type: "double" }
1277 1332 }
1278 1333 Method {
1279 1334 name: "replace"
1280 1335 revision: 3
1281 1336 Parameter { name: "index"; type: "int" }
1282 1337 Parameter { name: "newX"; type: "double" }
1283 1338 Parameter { name: "newY"; type: "double" }
1284 1339 }
1285 1340 Method {
1286 1341 name: "remove"
1287 1342 Parameter { name: "x"; type: "double" }
1288 1343 Parameter { name: "y"; type: "double" }
1289 1344 }
1290 1345 Method {
1291 1346 name: "remove"
1292 1347 revision: 3
1293 1348 Parameter { name: "index"; type: "int" }
1294 1349 }
1295 1350 Method {
1296 1351 name: "insert"
1297 1352 Parameter { name: "index"; type: "int" }
1298 1353 Parameter { name: "x"; type: "double" }
1299 1354 Parameter { name: "y"; type: "double" }
1300 1355 }
1301 1356 Method { name: "clear" }
1302 1357 Method {
1303 1358 name: "at"
1304 1359 type: "QPointF"
1305 1360 Parameter { name: "index"; type: "int" }
1306 1361 }
1307 1362 }
1308 1363 Component {
1309 1364 name: "QtCommercialChart::DeclarativeStackedBarSeries"
1310 1365 defaultProperty: "seriesChildren"
1311 1366 prototype: "QtCommercialChart::QStackedBarSeries"
1312 1367 exports: [
1313 1368 "QtCommercial.Chart/StackedBarSeries 1.0",
1314 1369 "QtCommercial.Chart/StackedBarSeries 1.1",
1315 1370 "QtCommercial.Chart/StackedBarSeries 1.2"
1316 1371 ]
1317 1372 exportMetaObjectRevisions: [0, 1, 2]
1318 1373 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1319 1374 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1320 1375 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1321 1376 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1322 1377 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
1323 1378 Signal {
1324 1379 name: "axisXChanged"
1325 1380 revision: 1
1326 1381 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1327 1382 }
1328 1383 Signal {
1329 1384 name: "axisYChanged"
1330 1385 revision: 1
1331 1386 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1332 1387 }
1333 1388 Signal {
1334 1389 name: "axisXTopChanged"
1335 1390 revision: 2
1336 1391 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1337 1392 }
1338 1393 Signal {
1339 1394 name: "axisYRightChanged"
1340 1395 revision: 2
1341 1396 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1342 1397 }
1343 1398 Method {
1344 1399 name: "appendSeriesChildren"
1345 1400 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1346 1401 Parameter { name: "element"; type: "QObject"; isPointer: true }
1347 1402 }
1348 1403 Method {
1349 1404 name: "at"
1350 1405 type: "DeclarativeBarSet*"
1351 1406 Parameter { name: "index"; type: "int" }
1352 1407 }
1353 1408 Method {
1354 1409 name: "append"
1355 1410 type: "DeclarativeBarSet*"
1356 1411 Parameter { name: "label"; type: "string" }
1357 1412 Parameter { name: "values"; type: "QVariantList" }
1358 1413 }
1359 1414 Method {
1360 1415 name: "insert"
1361 1416 type: "DeclarativeBarSet*"
1362 1417 Parameter { name: "index"; type: "int" }
1363 1418 Parameter { name: "label"; type: "string" }
1364 1419 Parameter { name: "values"; type: "QVariantList" }
1365 1420 }
1366 1421 Method {
1367 1422 name: "remove"
1368 1423 type: "bool"
1369 1424 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1370 1425 }
1371 1426 Method { name: "clear" }
1372 1427 }
1373 1428 Component {
1374 1429 name: "QtCommercialChart::DeclarativeXYPoint"
1375 1430 prototype: "QObject"
1376 1431 exports: ["QtCommercial.Chart/XYPoint 1.0"]
1377 1432 exportMetaObjectRevisions: [0]
1378 1433 Property { name: "x"; type: "double" }
1379 1434 Property { name: "y"; type: "double" }
1380 1435 }
1381 1436 Component {
1382 1437 name: "QtCommercialChart::LegendScroller"
1383 1438 defaultProperty: "children"
1384 1439 prototype: "QtCommercialChart::QLegend"
1385 1440 }
1386 1441 Component {
1387 1442 name: "QtCommercialChart::QAbstractAxis"
1388 1443 prototype: "QObject"
1389 1444 exports: ["QtCommercial.Chart/AbstractAxis 1.0"]
1390 isCreatable: false
1391 1445 exportMetaObjectRevisions: [0]
1392 1446 Property { name: "visible"; type: "bool" }
1393 1447 Property { name: "lineVisible"; type: "bool" }
1394 1448 Property { name: "linePen"; type: "QPen" }
1395 1449 Property { name: "color"; type: "QColor" }
1396 1450 Property { name: "labelsVisible"; type: "bool" }
1397 1451 Property { name: "labelsPen"; type: "QPen" }
1398 1452 Property { name: "labelsBrush"; type: "QBrush" }
1399 1453 Property { name: "labelsAngle"; type: "int" }
1400 1454 Property { name: "labelsFont"; type: "QFont" }
1401 1455 Property { name: "labelsColor"; type: "QColor" }
1402 1456 Property { name: "gridVisible"; type: "bool" }
1403 1457 Property { name: "gridLinePen"; type: "QPen" }
1404 1458 Property { name: "shadesVisible"; type: "bool" }
1405 1459 Property { name: "shadesColor"; type: "QColor" }
1406 1460 Property { name: "shadesBorderColor"; type: "QColor" }
1407 1461 Property { name: "shadesPen"; type: "QPen" }
1408 1462 Property { name: "shadesBrush"; type: "QBrush" }
1409 1463 Property { name: "titleText"; type: "string" }
1410 1464 Property { name: "titlePen"; type: "QPen" }
1411 1465 Property { name: "titleBrush"; type: "QBrush" }
1412 1466 Property { name: "titleVisible"; type: "bool" }
1413 1467 Property { name: "titleFont"; type: "QFont" }
1414 1468 Property { name: "orientation"; type: "Qt::Orientation"; isReadonly: true }
1415 1469 Property { name: "alignment"; type: "Qt::Alignment"; isReadonly: true }
1416 1470 Signal {
1417 1471 name: "visibleChanged"
1418 1472 Parameter { name: "visible"; type: "bool" }
1419 1473 }
1420 1474 Signal {
1421 1475 name: "linePenChanged"
1422 1476 Parameter { name: "pen"; type: "QPen" }
1423 1477 }
1424 1478 Signal {
1425 1479 name: "lineVisibleChanged"
1426 1480 Parameter { name: "visible"; type: "bool" }
1427 1481 }
1428 1482 Signal {
1429 1483 name: "labelsVisibleChanged"
1430 1484 Parameter { name: "visible"; type: "bool" }
1431 1485 }
1432 1486 Signal {
1433 1487 name: "labelsPenChanged"
1434 1488 Parameter { name: "pen"; type: "QPen" }
1435 1489 }
1436 1490 Signal {
1437 1491 name: "labelsBrushChanged"
1438 1492 Parameter { name: "brush"; type: "QBrush" }
1439 1493 }
1440 1494 Signal {
1441 1495 name: "labelsFontChanged"
1442 1496 Parameter { name: "pen"; type: "QFont" }
1443 1497 }
1444 1498 Signal {
1445 1499 name: "labelsAngleChanged"
1446 1500 Parameter { name: "angle"; type: "int" }
1447 1501 }
1448 1502 Signal {
1449 1503 name: "gridLinePenChanged"
1450 1504 Parameter { name: "pen"; type: "QPen" }
1451 1505 }
1452 1506 Signal {
1453 1507 name: "gridVisibleChanged"
1454 1508 Parameter { name: "visible"; type: "bool" }
1455 1509 }
1456 1510 Signal {
1457 1511 name: "colorChanged"
1458 1512 Parameter { name: "color"; type: "QColor" }
1459 1513 }
1460 1514 Signal {
1461 1515 name: "labelsColorChanged"
1462 1516 Parameter { name: "color"; type: "QColor" }
1463 1517 }
1464 1518 Signal {
1465 1519 name: "titleTextChanged"
1466 1520 Parameter { name: "title"; type: "string" }
1467 1521 }
1468 1522 Signal {
1469 1523 name: "titlePenChanged"
1470 1524 Parameter { name: "pen"; type: "QPen" }
1471 1525 }
1472 1526 Signal {
1473 1527 name: "titleBrushChanged"
1474 1528 Parameter { name: "brush"; type: "QBrush" }
1475 1529 }
1476 1530 Signal {
1477 1531 name: "titleVisibleChanged"
1478 1532 Parameter { name: "visible"; type: "bool" }
1479 1533 }
1480 1534 Signal {
1481 1535 name: "titleFontChanged"
1482 1536 Parameter { name: "font"; type: "QFont" }
1483 1537 }
1484 1538 Signal {
1485 1539 name: "shadesVisibleChanged"
1486 1540 Parameter { name: "visible"; type: "bool" }
1487 1541 }
1488 1542 Signal {
1489 1543 name: "shadesColorChanged"
1490 1544 Parameter { name: "color"; type: "QColor" }
1491 1545 }
1492 1546 Signal {
1493 1547 name: "shadesBorderColorChanged"
1494 1548 Parameter { name: "color"; type: "QColor" }
1495 1549 }
1496 1550 Signal {
1497 1551 name: "shadesPenChanged"
1498 1552 Parameter { name: "pen"; type: "QPen" }
1499 1553 }
1500 1554 Signal {
1501 1555 name: "shadesBrushChanged"
1502 1556 Parameter { name: "brush"; type: "QBrush" }
1503 1557 }
1504 1558 }
1505 1559 Component {
1506 1560 name: "QtCommercialChart::QAbstractBarSeries"
1507 1561 prototype: "QtCommercialChart::QAbstractSeries"
1508 1562 exports: ["QtCommercial.Chart/AbstractBarSeries 1.0"]
1509 isCreatable: false
1510 1563 exportMetaObjectRevisions: [0]
1511 1564 Property { name: "barWidth"; type: "double" }
1512 1565 Property { name: "count"; type: "int"; isReadonly: true }
1513 1566 Property { name: "labelsVisible"; type: "bool" }
1514 1567 Signal {
1515 1568 name: "clicked"
1516 1569 Parameter { name: "index"; type: "int" }
1517 1570 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1518 1571 }
1519 1572 Signal {
1520 1573 name: "hovered"
1521 1574 Parameter { name: "status"; type: "bool" }
1522 1575 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1523 1576 }
1524 1577 Signal {
1525 1578 name: "hovered"
1526 1579 Parameter { name: "status"; type: "bool" }
1527 1580 Parameter { name: "index"; type: "int" }
1528 1581 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1529 1582 }
1530 1583 Signal {
1531 1584 name: "barsetsAdded"
1532 1585 Parameter { name: "sets"; type: "QList<QBarSet*>" }
1533 1586 }
1534 1587 Signal {
1535 1588 name: "barsetsRemoved"
1536 1589 Parameter { name: "sets"; type: "QList<QBarSet*>" }
1537 1590 }
1538 1591 }
1539 1592 Component {
1540 1593 name: "QtCommercialChart::QAbstractSeries"
1541 1594 prototype: "QObject"
1542 1595 exports: ["QtCommercial.Chart/AbstractSeries 1.0"]
1543 isCreatable: false
1544 1596 exportMetaObjectRevisions: [0]
1545 1597 Enum {
1546 1598 name: "SeriesType"
1547 1599 values: {
1548 1600 "SeriesTypeLine": 0,
1549 1601 "SeriesTypeArea": 1,
1550 1602 "SeriesTypeBar": 2,
1551 1603 "SeriesTypeStackedBar": 3,
1552 1604 "SeriesTypePercentBar": 4,
1553 1605 "SeriesTypePie": 5,
1554 1606 "SeriesTypeScatter": 6,
1555 1607 "SeriesTypeSpline": 7,
1556 1608 "SeriesTypeHorizontalBar": 8,
1557 1609 "SeriesTypeHorizontalStackedBar": 9,
1558 1610 "SeriesTypeHorizontalPercentBar": 10,
1559 1611 "SeriesTypeBoxPlot": 11
1560 1612 }
1561 1613 }
1562 1614 Property { name: "name"; type: "string" }
1563 1615 Property { name: "visible"; type: "bool" }
1564 1616 Property { name: "opacity"; type: "double" }
1565 1617 Property { name: "type"; type: "SeriesType"; isReadonly: true }
1566 1618 }
1567 1619 Component {
1568 1620 name: "QtCommercialChart::QAreaSeries"
1569 1621 prototype: "QtCommercialChart::QAbstractSeries"
1570 1622 Property { name: "upperSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
1571 1623 Property { name: "lowerSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
1572 1624 Property { name: "color"; type: "QColor" }
1573 1625 Property { name: "borderColor"; type: "QColor" }
1574 1626 Signal {
1575 1627 name: "clicked"
1576 1628 Parameter { name: "point"; type: "QPointF" }
1577 1629 }
1578 1630 Signal {
1579 1631 name: "hovered"
1580 1632 Parameter { name: "point"; type: "QPointF" }
1581 1633 Parameter { name: "state"; type: "bool" }
1582 1634 }
1583 1635 Signal { name: "selected" }
1584 1636 Signal {
1585 1637 name: "colorChanged"
1586 1638 Parameter { name: "color"; type: "QColor" }
1587 1639 }
1588 1640 Signal {
1589 1641 name: "borderColorChanged"
1590 1642 Parameter { name: "color"; type: "QColor" }
1591 1643 }
1592 1644 }
1593 1645 Component {
1594 1646 name: "QtCommercialChart::QBarCategoryAxis"
1595 1647 prototype: "QtCommercialChart::QAbstractAxis"
1596 1648 exports: [
1597 1649 "QtCommercial.Chart/BarCategoriesAxis 1.0",
1598 1650 "QtCommercial.Chart/BarCategoryAxis 1.1"
1599 1651 ]
1600 1652 exportMetaObjectRevisions: [0, 0]
1601 1653 Property { name: "categories"; type: "QStringList" }
1602 1654 Property { name: "min"; type: "string" }
1603 1655 Property { name: "max"; type: "string" }
1604 1656 Property { name: "count"; type: "int"; isReadonly: true }
1605 1657 Signal {
1606 1658 name: "minChanged"
1607 1659 Parameter { name: "min"; type: "string" }
1608 1660 }
1609 1661 Signal {
1610 1662 name: "maxChanged"
1611 1663 Parameter { name: "max"; type: "string" }
1612 1664 }
1613 1665 Signal {
1614 1666 name: "rangeChanged"
1615 1667 Parameter { name: "min"; type: "string" }
1616 1668 Parameter { name: "max"; type: "string" }
1617 1669 }
1618 1670 }
1619 1671 Component {
1620 1672 name: "QtCommercialChart::QBarModelMapper"
1621 1673 prototype: "QObject"
1622 1674 exports: ["QtCommercial.Chart/BarModelMapper 1.0"]
1623 isCreatable: false
1624 1675 exportMetaObjectRevisions: [0]
1625 1676 }
1626 1677 Component {
1627 1678 name: "QtCommercialChart::QBarSeries"
1628 1679 prototype: "QtCommercialChart::QAbstractBarSeries"
1629 1680 }
1630 1681 Component {
1631 1682 name: "QtCommercialChart::QBarSet"
1632 1683 prototype: "QObject"
1633 1684 exports: ["QtCommercial.Chart/BarSetBase 1.0"]
1634 isCreatable: false
1635 1685 exportMetaObjectRevisions: [0]
1636 1686 Property { name: "label"; type: "string" }
1637 1687 Property { name: "pen"; type: "QPen" }
1638 1688 Property { name: "brush"; type: "QBrush" }
1639 1689 Property { name: "labelBrush"; type: "QBrush" }
1640 1690 Property { name: "labelFont"; type: "QFont" }
1641 1691 Property { name: "color"; type: "QColor" }
1642 1692 Property { name: "borderColor"; type: "QColor" }
1643 1693 Property { name: "labelColor"; type: "QColor" }
1644 1694 Signal {
1645 1695 name: "clicked"
1646 1696 Parameter { name: "index"; type: "int" }
1647 1697 }
1648 1698 Signal {
1649 1699 name: "hovered"
1650 1700 Parameter { name: "status"; type: "bool" }
1651 1701 }
1652 1702 Signal {
1653 1703 name: "hovered"
1654 1704 Parameter { name: "status"; type: "bool" }
1655 1705 Parameter { name: "index"; type: "int" }
1656 1706 }
1657 1707 Signal {
1658 1708 name: "colorChanged"
1659 1709 Parameter { name: "color"; type: "QColor" }
1660 1710 }
1661 1711 Signal {
1662 1712 name: "borderColorChanged"
1663 1713 Parameter { name: "color"; type: "QColor" }
1664 1714 }
1665 1715 Signal {
1666 1716 name: "labelColorChanged"
1667 1717 Parameter { name: "color"; type: "QColor" }
1668 1718 }
1669 1719 Signal {
1670 1720 name: "valuesAdded"
1671 1721 Parameter { name: "index"; type: "int" }
1672 1722 Parameter { name: "count"; type: "int" }
1673 1723 }
1674 1724 Signal {
1675 1725 name: "valuesRemoved"
1676 1726 Parameter { name: "index"; type: "int" }
1677 1727 Parameter { name: "count"; type: "int" }
1678 1728 }
1679 1729 Signal {
1680 1730 name: "valueChanged"
1681 1731 Parameter { name: "index"; type: "int" }
1682 1732 }
1683 1733 }
1684 1734 Component {
1685 1735 name: "QtCommercialChart::QBoxPlotSeries"
1686 1736 prototype: "QtCommercialChart::QAbstractSeries"
1687 1737 Property { name: "boxOutlineVisible"; type: "bool" }
1688 1738 Property { name: "boxWidth"; type: "double" }
1689 1739 Property { name: "pen"; type: "QPen" }
1690 1740 Property { name: "brush"; type: "QBrush" }
1691 1741 Signal {
1692 1742 name: "clicked"
1693 1743 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1694 1744 }
1695 1745 Signal {
1696 1746 name: "hovered"
1697 1747 Parameter { name: "status"; type: "bool" }
1698 1748 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1699 1749 }
1700 1750 Signal { name: "countChanged" }
1701 1751 Signal { name: "boxOutlineVisibilityChanged" }
1702 1752 Signal {
1703 1753 name: "boxsetsAdded"
1704 1754 Parameter { name: "sets"; type: "QList<QBoxSet*>" }
1705 1755 }
1706 1756 Signal {
1707 1757 name: "boxsetsRemoved"
1708 1758 Parameter { name: "sets"; type: "QList<QBoxSet*>" }
1709 1759 }
1710 1760 }
1711 1761 Component {
1712 1762 name: "QtCommercialChart::QBoxSet"
1713 1763 prototype: "QObject"
1714 1764 Property { name: "pen"; type: "QPen" }
1715 1765 Property { name: "brush"; type: "QBrush" }
1716 1766 Signal { name: "clicked" }
1717 1767 Signal {
1718 1768 name: "hovered"
1719 1769 Parameter { name: "status"; type: "bool" }
1720 1770 }
1721 1771 Signal { name: "valuesChanged" }
1722 1772 Signal {
1723 1773 name: "valueChanged"
1724 1774 Parameter { name: "index"; type: "int" }
1725 1775 }
1726 1776 Signal { name: "cleared" }
1727 1777 }
1728 1778 Component {
1729 1779 name: "QtCommercialChart::QCategoryAxis"
1730 1780 prototype: "QtCommercialChart::QValueAxis"
1731 1781 Property { name: "startValue"; type: "double" }
1732 1782 Property { name: "count"; type: "int"; isReadonly: true }
1733 1783 Property { name: "categoriesLabels"; type: "QStringList"; isReadonly: true }
1734 1784 Signal { name: "categoriesChanged" }
1735 1785 }
1736 1786 Component {
1737 1787 name: "QtCommercialChart::QDateTimeAxis"
1738 1788 prototype: "QtCommercialChart::QAbstractAxis"
1739 1789 exports: ["QtCommercial.Chart/DateTimeAxis 1.1"]
1740 1790 exportMetaObjectRevisions: [0]
1741 1791 Property { name: "tickCount"; type: "int" }
1742 1792 Property { name: "min"; type: "QDateTime" }
1743 1793 Property { name: "max"; type: "QDateTime" }
1744 1794 Property { name: "format"; type: "string" }
1745 1795 Signal {
1746 1796 name: "minChanged"
1747 1797 Parameter { name: "min"; type: "QDateTime" }
1748 1798 }
1749 1799 Signal {
1750 1800 name: "maxChanged"
1751 1801 Parameter { name: "max"; type: "QDateTime" }
1752 1802 }
1753 1803 Signal {
1754 1804 name: "rangeChanged"
1755 1805 Parameter { name: "min"; type: "QDateTime" }
1756 1806 Parameter { name: "max"; type: "QDateTime" }
1757 1807 }
1758 1808 Signal {
1759 1809 name: "formatChanged"
1760 1810 Parameter { name: "format"; type: "string" }
1761 1811 }
1762 1812 Signal {
1763 1813 name: "tickCountChanged"
1764 1814 Parameter { name: "tick"; type: "int" }
1765 1815 }
1766 1816 }
1767 1817 Component {
1768 1818 name: "QtCommercialChart::QHBarModelMapper"
1769 1819 prototype: "QtCommercialChart::QBarModelMapper"
1770 1820 exports: ["QtCommercial.Chart/HBarModelMapper 1.0"]
1771 1821 exportMetaObjectRevisions: [0]
1772 1822 Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
1773 1823 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
1774 1824 Property { name: "firstBarSetRow"; type: "int" }
1775 1825 Property { name: "lastBarSetRow"; type: "int" }
1776 1826 Property { name: "firstColumn"; type: "int" }
1777 1827 Property { name: "columnCount"; type: "int" }
1778 1828 Signal { name: "seriesReplaced" }
1779 1829 Signal { name: "modelReplaced" }
1780 1830 }
1781 1831 Component {
1782 1832 name: "QtCommercialChart::QHPieModelMapper"
1783 1833 prototype: "QtCommercialChart::QPieModelMapper"
1784 1834 exports: ["QtCommercial.Chart/HPieModelMapper 1.0"]
1785 1835 exportMetaObjectRevisions: [0]
1786 1836 Property { name: "series"; type: "QPieSeries"; isPointer: true }
1787 1837 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
1788 1838 Property { name: "valuesRow"; type: "int" }
1789 1839 Property { name: "labelsRow"; type: "int" }
1790 1840 Property { name: "firstColumn"; type: "int" }
1791 1841 Property { name: "columnCount"; type: "int" }
1792 1842 Signal { name: "seriesReplaced" }
1793 1843 Signal { name: "modelReplaced" }
1794 1844 }
1795 1845 Component {
1796 1846 name: "QtCommercialChart::QHXYModelMapper"
1797 1847 prototype: "QtCommercialChart::QXYModelMapper"
1798 1848 exports: ["QtCommercial.Chart/HXYModelMapper 1.0"]
1799 1849 exportMetaObjectRevisions: [0]
1800 1850 Property { name: "series"; type: "QXYSeries"; isPointer: true }
1801 1851 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
1802 1852 Property { name: "xRow"; type: "int" }
1803 1853 Property { name: "yRow"; type: "int" }
1804 1854 Property { name: "firstColumn"; type: "int" }
1805 1855 Property { name: "columnCount"; type: "int" }
1806 1856 Signal { name: "seriesReplaced" }
1807 1857 Signal { name: "modelReplaced" }
1808 1858 }
1809 1859 Component {
1810 1860 name: "QtCommercialChart::QHorizontalBarSeries"
1811 1861 prototype: "QtCommercialChart::QAbstractBarSeries"
1812 1862 }
1813 1863 Component {
1814 1864 name: "QtCommercialChart::QHorizontalPercentBarSeries"
1815 1865 prototype: "QtCommercialChart::QAbstractBarSeries"
1816 1866 }
1817 1867 Component {
1818 1868 name: "QtCommercialChart::QHorizontalStackedBarSeries"
1819 1869 prototype: "QtCommercialChart::QAbstractBarSeries"
1820 1870 }
1821 1871 Component {
1822 1872 name: "QtCommercialChart::QLegend"
1823 1873 defaultProperty: "children"
1824 1874 prototype: "QGraphicsWidget"
1825 1875 exports: ["QtCommercial.Chart/Legend 1.0"]
1826 isCreatable: false
1827 1876 exportMetaObjectRevisions: [0]
1828 1877 Property { name: "alignment"; type: "Qt::Alignment" }
1829 1878 Property { name: "backgroundVisible"; type: "bool" }
1830 1879 Property { name: "color"; type: "QColor" }
1831 1880 Property { name: "borderColor"; type: "QColor" }
1832 1881 Property { name: "font"; type: "QFont" }
1833 1882 Property { name: "labelColor"; type: "QColor" }
1834 1883 Property { name: "reverseMarkers"; type: "bool" }
1835 1884 Signal {
1836 1885 name: "backgroundVisibleChanged"
1837 1886 Parameter { name: "visible"; type: "bool" }
1838 1887 }
1839 1888 Signal {
1840 1889 name: "colorChanged"
1841 1890 Parameter { name: "color"; type: "QColor" }
1842 1891 }
1843 1892 Signal {
1844 1893 name: "borderColorChanged"
1845 1894 Parameter { name: "color"; type: "QColor" }
1846 1895 }
1847 1896 Signal {
1848 1897 name: "fontChanged"
1849 1898 Parameter { name: "font"; type: "QFont" }
1850 1899 }
1851 1900 Signal {
1852 1901 name: "labelColorChanged"
1853 1902 Parameter { name: "color"; type: "QColor" }
1854 1903 }
1855 1904 Signal {
1856 1905 name: "reverseMarkersChanged"
1857 1906 Parameter { name: "reverseMarkers"; type: "bool" }
1858 1907 }
1859 1908 }
1860 1909 Component { name: "QtCommercialChart::QLineSeries"; prototype: "QtCommercialChart::QXYSeries" }
1861 1910 Component {
1862 1911 name: "QtCommercialChart::QLogValueAxis"
1863 1912 prototype: "QtCommercialChart::QAbstractAxis"
1864 1913 exports: ["QtCommercial.Chart/LogValueAxis 1.3"]
1865 1914 exportMetaObjectRevisions: [0]
1866 1915 Property { name: "min"; type: "double" }
1867 1916 Property { name: "max"; type: "double" }
1868 1917 Property { name: "labelFormat"; type: "string" }
1869 1918 Property { name: "base"; type: "double" }
1870 1919 Signal {
1871 1920 name: "minChanged"
1872 1921 Parameter { name: "min"; type: "double" }
1873 1922 }
1874 1923 Signal {
1875 1924 name: "maxChanged"
1876 1925 Parameter { name: "max"; type: "double" }
1877 1926 }
1878 1927 Signal {
1879 1928 name: "rangeChanged"
1880 1929 Parameter { name: "min"; type: "double" }
1881 1930 Parameter { name: "max"; type: "double" }
1882 1931 }
1883 1932 Signal {
1884 1933 name: "labelFormatChanged"
1885 1934 Parameter { name: "format"; type: "string" }
1886 1935 }
1887 1936 Signal {
1888 1937 name: "baseChanged"
1889 1938 Parameter { name: "base"; type: "double" }
1890 1939 }
1891 1940 }
1892 1941 Component {
1893 1942 name: "QtCommercialChart::QPercentBarSeries"
1894 1943 prototype: "QtCommercialChart::QAbstractBarSeries"
1895 1944 }
1896 1945 Component {
1897 1946 name: "QtCommercialChart::QPieModelMapper"
1898 1947 prototype: "QObject"
1899 1948 exports: ["QtCommercial.Chart/PieModelMapper 1.0"]
1900 isCreatable: false
1901 1949 exportMetaObjectRevisions: [0]
1902 1950 }
1903 1951 Component {
1904 1952 name: "QtCommercialChart::QPieSeries"
1905 1953 prototype: "QtCommercialChart::QAbstractSeries"
1906 1954 exports: ["QtCommercial.Chart/QPieSeries 1.0"]
1907 isCreatable: false
1908 1955 exportMetaObjectRevisions: [0]
1909 1956 Property { name: "horizontalPosition"; type: "double" }
1910 1957 Property { name: "verticalPosition"; type: "double" }
1911 1958 Property { name: "size"; type: "double" }
1912 1959 Property { name: "startAngle"; type: "double" }
1913 1960 Property { name: "endAngle"; type: "double" }
1914 1961 Property { name: "count"; type: "int"; isReadonly: true }
1915 1962 Property { name: "sum"; type: "double"; isReadonly: true }
1916 1963 Property { name: "holeSize"; type: "double" }
1917 1964 Signal {
1918 1965 name: "added"
1919 1966 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
1920 1967 }
1921 1968 Signal {
1922 1969 name: "removed"
1923 1970 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
1924 1971 }
1925 1972 Signal {
1926 1973 name: "clicked"
1927 1974 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1928 1975 }
1929 1976 Signal {
1930 1977 name: "hovered"
1931 1978 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1932 1979 Parameter { name: "state"; type: "bool" }
1933 1980 }
1934 1981 }
1935 1982 Component {
1936 1983 name: "QtCommercialChart::QPieSlice"
1937 1984 prototype: "QObject"
1938 1985 exports: ["QtCommercial.Chart/PieSlice 1.0"]
1939 1986 exportMetaObjectRevisions: [0]
1940 1987 Enum {
1941 1988 name: "LabelPosition"
1942 1989 values: {
1943 1990 "LabelOutside": 0,
1944 1991 "LabelInsideHorizontal": 1,
1945 1992 "LabelInsideTangential": 2,
1946 1993 "LabelInsideNormal": 3
1947 1994 }
1948 1995 }
1949 1996 Property { name: "label"; type: "string" }
1950 1997 Property { name: "value"; type: "double" }
1951 1998 Property { name: "labelVisible"; type: "bool" }
1952 1999 Property { name: "labelPosition"; type: "LabelPosition" }
1953 2000 Property { name: "exploded"; type: "bool" }
1954 2001 Property { name: "pen"; type: "QPen" }
1955 2002 Property { name: "borderColor"; type: "QColor" }
1956 2003 Property { name: "borderWidth"; type: "int" }
1957 2004 Property { name: "brush"; type: "QBrush" }
1958 2005 Property { name: "color"; type: "QColor" }
1959 2006 Property { name: "labelBrush"; type: "QBrush" }
1960 2007 Property { name: "labelColor"; type: "QColor" }
1961 2008 Property { name: "labelFont"; type: "QFont" }
1962 2009 Property { name: "labelArmLengthFactor"; type: "double" }
1963 2010 Property { name: "explodeDistanceFactor"; type: "double" }
1964 2011 Property { name: "percentage"; type: "double"; isReadonly: true }
1965 2012 Property { name: "startAngle"; type: "double"; isReadonly: true }
1966 2013 Property { name: "angleSpan"; type: "double"; isReadonly: true }
1967 2014 Signal { name: "clicked" }
1968 2015 Signal {
1969 2016 name: "hovered"
1970 2017 Parameter { name: "state"; type: "bool" }
1971 2018 }
1972 2019 }
1973 2020 Component {
1974 2021 name: "QtCommercialChart::QScatterSeries"
1975 2022 prototype: "QtCommercialChart::QXYSeries"
1976 2023 Enum {
1977 2024 name: "MarkerShape"
1978 2025 values: {
1979 2026 "MarkerShapeCircle": 0,
1980 2027 "MarkerShapeRectangle": 1
1981 2028 }
1982 2029 }
1983 2030 Property { name: "color"; type: "QColor" }
1984 2031 Property { name: "borderColor"; type: "QColor" }
1985 2032 Property { name: "markerShape"; type: "MarkerShape" }
1986 2033 Property { name: "markerSize"; type: "double" }
2034 Property { name: "brush"; type: "QBrush" }
1987 2035 Signal {
1988 2036 name: "colorChanged"
1989 2037 Parameter { name: "color"; type: "QColor" }
1990 2038 }
1991 2039 Signal {
1992 2040 name: "borderColorChanged"
1993 2041 Parameter { name: "color"; type: "QColor" }
1994 2042 }
1995 2043 }
1996 2044 Component {
1997 2045 name: "QtCommercialChart::QSplineSeries"
1998 2046 prototype: "QtCommercialChart::QLineSeries"
1999 2047 }
2000 2048 Component {
2001 2049 name: "QtCommercialChart::QStackedBarSeries"
2002 2050 prototype: "QtCommercialChart::QAbstractBarSeries"
2003 2051 }
2004 2052 Component {
2005 2053 name: "QtCommercialChart::QVBarModelMapper"
2006 2054 prototype: "QtCommercialChart::QBarModelMapper"
2007 2055 exports: ["QtCommercial.Chart/VBarModelMapper 1.0"]
2008 2056 exportMetaObjectRevisions: [0]
2009 2057 Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
2010 2058 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2011 2059 Property { name: "firstBarSetColumn"; type: "int" }
2012 2060 Property { name: "lastBarSetColumn"; type: "int" }
2013 2061 Property { name: "firstRow"; type: "int" }
2014 2062 Property { name: "rowCount"; type: "int" }
2015 2063 Signal { name: "seriesReplaced" }
2016 2064 Signal { name: "modelReplaced" }
2017 2065 }
2018 2066 Component {
2019 2067 name: "QtCommercialChart::QVPieModelMapper"
2020 2068 prototype: "QtCommercialChart::QPieModelMapper"
2021 2069 exports: ["QtCommercial.Chart/VPieModelMapper 1.0"]
2022 2070 exportMetaObjectRevisions: [0]
2023 2071 Property { name: "series"; type: "QPieSeries"; isPointer: true }
2024 2072 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2025 2073 Property { name: "valuesColumn"; type: "int" }
2026 2074 Property { name: "labelsColumn"; type: "int" }
2027 2075 Property { name: "firstRow"; type: "int" }
2028 2076 Property { name: "rowCount"; type: "int" }
2029 2077 Signal { name: "seriesReplaced" }
2030 2078 Signal { name: "modelReplaced" }
2031 2079 }
2032 2080 Component {
2033 2081 name: "QtCommercialChart::QVXYModelMapper"
2034 2082 prototype: "QtCommercialChart::QXYModelMapper"
2035 2083 exports: ["QtCommercial.Chart/VXYModelMapper 1.0"]
2036 2084 exportMetaObjectRevisions: [0]
2037 2085 Property { name: "series"; type: "QXYSeries"; isPointer: true }
2038 2086 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2039 2087 Property { name: "xColumn"; type: "int" }
2040 2088 Property { name: "yColumn"; type: "int" }
2041 2089 Property { name: "firstRow"; type: "int" }
2042 2090 Property { name: "rowCount"; type: "int" }
2043 2091 Signal { name: "seriesReplaced" }
2044 2092 Signal { name: "modelReplaced" }
2045 2093 }
2046 2094 Component {
2047 2095 name: "QtCommercialChart::QValueAxis"
2048 2096 prototype: "QtCommercialChart::QAbstractAxis"
2049 2097 exports: [
2050 2098 "QtCommercial.Chart/ValueAxis 1.1",
2051 2099 "QtCommercial.Chart/ValuesAxis 1.0"
2052 2100 ]
2053 2101 exportMetaObjectRevisions: [0, 0]
2054 2102 Property { name: "tickCount"; type: "int" }
2055 2103 Property { name: "niceNumbersEnabled"; type: "bool" }
2056 2104 Property { name: "min"; type: "double" }
2057 2105 Property { name: "max"; type: "double" }
2058 2106 Property { name: "labelFormat"; type: "string" }
2059 2107 Signal {
2060 2108 name: "minChanged"
2061 2109 Parameter { name: "min"; type: "double" }
2062 2110 }
2063 2111 Signal {
2064 2112 name: "maxChanged"
2065 2113 Parameter { name: "max"; type: "double" }
2066 2114 }
2067 2115 Signal {
2068 2116 name: "rangeChanged"
2069 2117 Parameter { name: "min"; type: "double" }
2070 2118 Parameter { name: "max"; type: "double" }
2071 2119 }
2072 2120 Signal {
2073 2121 name: "tickCountChanged"
2074 2122 Parameter { name: "tickCount"; type: "int" }
2075 2123 }
2076 2124 Signal {
2077 2125 name: "labelFormatChanged"
2078 2126 Parameter { name: "format"; type: "string" }
2079 2127 }
2080 2128 Method { name: "applyNiceNumbers" }
2081 2129 }
2082 2130 Component {
2083 2131 name: "QtCommercialChart::QXYModelMapper"
2084 2132 prototype: "QObject"
2085 2133 exports: ["QtCommercial.Chart/XYModelMapper 1.0"]
2086 isCreatable: false
2087 2134 exportMetaObjectRevisions: [0]
2088 2135 }
2089 2136 Component {
2090 2137 name: "QtCommercialChart::QXYSeries"
2091 2138 prototype: "QtCommercialChart::QAbstractSeries"
2092 2139 exports: ["QtCommercial.Chart/XYSeries 1.0"]
2093 isCreatable: false
2094 2140 exportMetaObjectRevisions: [0]
2095 2141 Property { name: "pointsVisible"; type: "bool" }
2096 2142 Property { name: "color"; type: "QColor" }
2097 2143 Signal {
2098 2144 name: "clicked"
2099 2145 Parameter { name: "point"; type: "QPointF" }
2100 2146 }
2101 2147 Signal {
2102 2148 name: "hovered"
2103 2149 Parameter { name: "point"; type: "QPointF" }
2104 2150 Parameter { name: "state"; type: "bool" }
2105 2151 }
2106 2152 Signal {
2107 2153 name: "pointReplaced"
2108 2154 Parameter { name: "index"; type: "int" }
2109 2155 }
2110 2156 Signal {
2111 2157 name: "pointRemoved"
2112 2158 Parameter { name: "index"; type: "int" }
2113 2159 }
2114 2160 Signal {
2115 2161 name: "pointAdded"
2116 2162 Parameter { name: "index"; type: "int" }
2117 2163 }
2118 2164 Signal {
2119 2165 name: "colorChanged"
2120 2166 Parameter { name: "color"; type: "QColor" }
2121 2167 }
2122 2168 Signal { name: "pointsReplaced" }
2123 2169 }
2124 2170 }
@@ -1,474 +1,479
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qareaseries.h"
22 22 #include "qareaseries_p.h"
23 23 #include "qlineseries.h"
24 24 #include "areachartitem_p.h"
25 25 #include "abstractdomain_p.h"
26 26 #include "chartdataset_p.h"
27 27 #include "charttheme_p.h"
28 28 #include "qvalueaxis.h"
29 29 #include "qarealegendmarker.h"
30 30 #include "qchart_p.h"
31 31
32 32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33 33
34 34 /*!
35 35 \class QAreaSeries
36 36 \inmodule Qt Charts
37 37 \brief The QAreaSeries class is used for making area charts.
38 38
39 39 \mainclass
40 40
41 41 An area chart is used to show quantitative data. It is based on line chart, in the way that area between axis and the line
42 42 is emphasized with color. Since the area chart is based on line chart, QAreaSeries constructor needs QLineSeries instance,
43 43 which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X. Instead of axis X "lower" boundary can be specified by other line.
44 44 In that case QAreaSeries should be initiated with two QLineSeries instances. Please note terms "upper" and "lower" boundary can be misleading in cases
45 45 where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary lines will be filled.
46 46
47 47 See the \l {AreaChart Example} {area chart example} to learn how to create a simple area chart.
48 48 \image examples_areachart.png
49 49 */
50 50 #ifdef QDOC_QT5
51 51 /*!
52 52 \qmltype AreaSeries
53 53 \instantiates QAreaSeries
54 54 \inqmlmodule QtCommercial.Chart
55 55
56 56 \include doc/src/areaseries.qdocinc
57 57 */
58 58 #else
59 59 /*!
60 60 \qmlclass AreaSeries QAreaSeries
61 61
62 62 \include ../doc/src/areaseries.qdocinc
63 63 */
64 64 #endif
65 65
66 66 /*!
67 67 \property QAreaSeries::upperSeries
68 68 \brief The upper one of the two line series used to define area series boundaries.
69 69 */
70 70 /*!
71 71 \qmlproperty LineSeries AreaSeries::upperSeries
72 72 The upper one of the two line series used to define area series boundaries.
73 73 */
74 74
75 75 /*!
76 76 \property QAreaSeries::lowerSeries
77 77 The lower one of the two line series used to define are series boundaries. Note if
78 78 QAreaSeries was constructed without a\ lowerSeries this is null.
79 79 */
80 80 /*!
81 81 \qmlproperty LineSeries AreaSeries::lowerSeries
82 82 The lower one of the two line series used to define are series boundaries. Note if
83 83 AreaSeries was constructed without a\ lowerSeries this is null.
84 84 */
85 85
86 86 /*!
87 87 \property QAreaSeries::color
88 88 Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
89 89 \sa QAreaSeries::brush()
90 90 */
91 91 /*!
92 92 \qmlproperty color AreaSeries::color
93 93 Fill (brush) color of the series.
94 94 */
95 95
96 96 /*!
97 97 \property QAreaSeries::borderColor
98 98 Line (pen) color of the series. This is a convenience property for modifying the color of pen.
99 99 \sa QAreaSeries::pen()
100 100 */
101 101 /*!
102 102 \qmlproperty color AreaSeries::borderColor
103 103 Line (pen) color of the series.
104 104 */
105 105
106 106 /*!
107 107 \qmlproperty real AreaSeries::borderWidth
108 108 The width of the border line. By default the width is 2.0.
109 109 */
110 110
111 111 /*!
112 112 \fn QPen QAreaSeries::pen() const
113 113 \brief Returns the pen used to draw line for this series.
114 114 \sa setPen()
115 115 */
116 116
117 117 /*!
118 118 \fn QPen QAreaSeries::brush() const
119 119 \brief Returns the brush used to draw line for this series.
120 120 \sa setBrush()
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 129 \fn void QAreaSeries::colorChanged(QColor color)
125 130 \brief Signal is emitted when the fill (brush) color has changed to \a color.
126 131 */
127 132 /*!
128 133 \qmlsignal AreaSeries::onColorChanged(color color)
129 134 Signal is emitted when the fill (brush) color has changed to \a color.
130 135 */
131 136
132 137 /*!
133 138 \fn void QAreaSeries::borderColorChanged(QColor color)
134 139 \brief Signal is emitted when the line (pen) color has changed to \a color.
135 140 */
136 141 /*!
137 142 \qmlsignal AreaSeries::onBorderColorChanged(color color)
138 143 Signal is emitted when the line (pen) color has changed to \a color.
139 144 */
140 145
141 146 /*!
142 147 \fn void QAreaSeries::clicked(const QPointF& point)
143 148 \brief Signal is emitted when user clicks the \a point on area chart.
144 149 */
145 150 /*!
146 151 \qmlsignal AreaSeries::onClicked(QPointF point)
147 152 Signal is emitted when user clicks the \a point on area chart.
148 153 */
149 154
150 155 /*!
151 156 \fn void QAreaSeries::hovered(const QPointF &point, bool state)
152 157 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
153 158 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
154 159 the series.
155 160 */
156 161 /*!
157 162 \qmlsignal AreaSeries::onHovered(point point, bool state)
158 163 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
159 164 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
160 165 the series.
161 166 */
162 167
163 168 /*!
164 169 \fn void QAreaSeries::selected()
165 170 The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
166 171 implemented by the user of QAreaSeries API.
167 172 */
168 173 /*!
169 174 \qmlsignal AreaSeries::onSelected()
170 175 The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
171 176 implemented by the user of AreaSeries API.
172 177 */
173 178
174 179 /*!
175 180 \fn void QAreaSeriesPrivate::updated()
176 181 \brief \internal
177 182 */
178 183
179 184 /*!
180 185 Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a
181 186 upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead.
182 187 When series object is added to QChartView or QChart instance ownerships is transferred.
183 188 */
184 189 QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries)
185 190 : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries, lowerSeries, this), upperSeries)
186 191 {
187 192 }
188 193
189 194 /*!
190 195 Constructs area series object without upper or lower series with \a parent object.
191 196 */
192 197 QAreaSeries::QAreaSeries(QObject *parent)
193 198 : QAbstractSeries(*new QAreaSeriesPrivate(0, 0, this), parent)
194 199 {
195 200 }
196 201
197 202 /*!
198 203 Destroys the object.
199 204 */
200 205 QAreaSeries::~QAreaSeries()
201 206 {
202 207 Q_D(QAreaSeries);
203 208 if (d->m_chart)
204 209 d->m_chart->removeSeries(this);
205 210 }
206 211
207 212 /*!
208 213 Returns QAbstractSeries::SeriesTypeArea.
209 214 */
210 215 QAbstractSeries::SeriesType QAreaSeries::type() const
211 216 {
212 217 return QAbstractSeries::SeriesTypeArea;
213 218 }
214 219
215 220 /*!
216 221 Sets the \a series that is to be used as the area chart upper series.
217 222 */
218 223 void QAreaSeries::setUpperSeries(QLineSeries *series)
219 224 {
220 225 Q_D(QAreaSeries);
221 226 if (d->m_upperSeries != series)
222 227 d->m_upperSeries = series;
223 228 }
224 229
225 230 QLineSeries *QAreaSeries::upperSeries() const
226 231 {
227 232 Q_D(const QAreaSeries);
228 233 return d->m_upperSeries;
229 234 }
230 235
231 236 /*!
232 237 Sets the \a series that is to be used as the area chart lower series.
233 238 */
234 239 void QAreaSeries::setLowerSeries(QLineSeries *series)
235 240 {
236 241 Q_D(QAreaSeries);
237 242 d->m_lowerSeries = series;
238 243 }
239 244
240 245 QLineSeries *QAreaSeries::lowerSeries() const
241 246 {
242 247 Q_D(const QAreaSeries);
243 248 return d->m_lowerSeries;
244 249 }
245 250
246 251 /*!
247 252 Sets \a pen used for drawing area outline.
248 253 */
249 254 void QAreaSeries::setPen(const QPen &pen)
250 255 {
251 256 Q_D(QAreaSeries);
252 257 if (d->m_pen != pen) {
253 258 d->m_pen = pen;
254 259 emit d->updated();
255 260 }
256 261 }
257 262
258 263 QPen QAreaSeries::pen() const
259 264 {
260 265 Q_D(const QAreaSeries);
261 266 if (d->m_pen == QChartPrivate::defaultPen())
262 267 return QPen();
263 268 else
264 269 return d->m_pen;
265 270 }
266 271
267 272 /*!
268 273 Sets \a brush used for filling the area.
269 274 */
270 275 void QAreaSeries::setBrush(const QBrush &brush)
271 276 {
272 277 Q_D(QAreaSeries);
273 278 if (d->m_brush != brush) {
274 279 bool emitColorChanged = brush.color() != d->m_brush.color();
275 280 d->m_brush = brush;
276 281 emit d->updated();
277 282 if (emitColorChanged)
278 283 emit colorChanged(brush.color());
279 284 }
280 285 }
281 286
282 287 QBrush QAreaSeries::brush() const
283 288 {
284 289 Q_D(const QAreaSeries);
285 290 if (d->m_brush == QChartPrivate::defaultBrush())
286 291 return QBrush();
287 292 else
288 293 return d->m_brush;
289 294 }
290 295
291 296 void QAreaSeries::setColor(const QColor &color)
292 297 {
293 298 QBrush b = brush();
294 299 if (b == QBrush())
295 300 b.setStyle(Qt::SolidPattern);
296 301 b.setColor(color);
297 302 setBrush(b);
298 303 }
299 304
300 305 QColor QAreaSeries::color() const
301 306 {
302 307 return brush().color();
303 308 }
304 309
305 310 void QAreaSeries::setBorderColor(const QColor &color)
306 311 {
307 312 QPen p = pen();
308 313 if (p.color() != color) {
309 314 p.setColor(color);
310 315 setPen(p);
311 316 emit borderColorChanged(color);
312 317 }
313 318 }
314 319
315 320 QColor QAreaSeries::borderColor() const
316 321 {
317 322 return pen().color();
318 323 }
319 324
320 325 /*!
321 326 Sets if data points are \a visible and should be drawn on line.
322 327 */
323 328 void QAreaSeries::setPointsVisible(bool visible)
324 329 {
325 330 Q_D(QAreaSeries);
326 331 if (d->m_pointsVisible != visible) {
327 332 d->m_pointsVisible = visible;
328 333 emit d->updated();
329 334 }
330 335 }
331 336
332 337 /*!
333 338 Returns if the points are drawn for this series.
334 339 \sa setPointsVisible()
335 340 */
336 341 bool QAreaSeries::pointsVisible() const
337 342 {
338 343 Q_D(const QAreaSeries);
339 344 return d->m_pointsVisible;
340 345 }
341 346
342 347 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
343 348
344 349 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q)
345 350 : QAbstractSeriesPrivate(q),
346 351 m_brush(QChartPrivate::defaultBrush()),
347 352 m_pen(QChartPrivate::defaultPen()),
348 353 m_upperSeries(upperSeries),
349 354 m_lowerSeries(lowerSeries),
350 355 m_pointsVisible(false)
351 356 {
352 357 }
353 358
354 359 void QAreaSeriesPrivate::initializeDomain()
355 360 {
356 361 Q_Q(QAreaSeries);
357 362
358 363 qreal minX(domain()->minX());
359 364 qreal minY(domain()->minY());
360 365 qreal maxX(domain()->maxX());
361 366 qreal maxY(domain()->maxY());
362 367
363 368 QLineSeries *upperSeries = q->upperSeries();
364 369 QLineSeries *lowerSeries = q->lowerSeries();
365 370
366 371 if (upperSeries) {
367 372 const QList<QPointF>& points = upperSeries->points();
368 373
369 374 for (int i = 0; i < points.count(); i++) {
370 375 qreal x = points[i].x();
371 376 qreal y = points[i].y();
372 377 minX = qMin(minX, x);
373 378 minY = qMin(minY, y);
374 379 maxX = qMax(maxX, x);
375 380 maxY = qMax(maxY, y);
376 381 }
377 382 }
378 383 if (lowerSeries) {
379 384
380 385 const QList<QPointF>& points = lowerSeries->points();
381 386
382 387 for (int i = 0; i < points.count(); i++) {
383 388 qreal x = points[i].x();
384 389 qreal y = points[i].y();
385 390 minX = qMin(minX, x);
386 391 minY = qMin(minY, y);
387 392 maxX = qMax(maxX, x);
388 393 maxY = qMax(maxY, y);
389 394 }
390 395 }
391 396
392 397 domain()->setRange(minX, maxX, minY, maxY);
393 398 }
394 399
395 400 void QAreaSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
396 401 {
397 402 Q_Q(QAreaSeries);
398 403 AreaChartItem *area = new AreaChartItem(q,parent);
399 404 m_item.reset(area);
400 405 QAbstractSeriesPrivate::initializeGraphics(parent);
401 406 }
402 407 void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
403 408 {
404 409 Q_Q(QAreaSeries);
405 410 AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data());
406 411
407 412 if (q->upperSeries() && area->upperLineItem()->animation())
408 413 area->upperLineItem()->animation()->stopAndDestroyLater();
409 414 if (q->lowerSeries() && area->lowerLineItem()->animation())
410 415 area->lowerLineItem()->animation()->stopAndDestroyLater();
411 416
412 417 if (options.testFlag(QChart::SeriesAnimations)) {
413 418 area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem()));
414 419 if (q->lowerSeries())
415 420 area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem()));
416 421 } else {
417 422 if (q->upperSeries())
418 423 area->upperLineItem()->setAnimation(0);
419 424 if (q->lowerSeries())
420 425 area->lowerLineItem()->setAnimation(0);
421 426 }
422 427 QAbstractSeriesPrivate::initializeAnimations(options);
423 428 }
424 429
425 430 QList<QLegendMarker*> QAreaSeriesPrivate::createLegendMarkers(QLegend* legend)
426 431 {
427 432 Q_Q(QAreaSeries);
428 433 QList<QLegendMarker*> list;
429 434 return list << new QAreaLegendMarker(q,legend);
430 435 }
431 436
432 437
433 438 void QAreaSeriesPrivate::initializeAxes()
434 439 {
435 440
436 441 }
437 442
438 443 QAbstractAxis::AxisType QAreaSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
439 444 {
440 445 Q_UNUSED(orientation);
441 446 return QAbstractAxis::AxisTypeValue;
442 447 }
443 448
444 449 QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
445 450 {
446 451 Q_UNUSED(orientation);
447 452 return new QValueAxis;
448 453 }
449 454
450 455 void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
451 456 {
452 457 Q_Q(QAreaSeries);
453 458
454 459 const QList<QGradient> gradients = theme->seriesGradients();
455 460 const QList<QColor> colors = theme->seriesColors();
456 461
457 462 if (forced || QChartPrivate::defaultPen() == m_pen) {
458 463 QPen pen;
459 464 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
460 465 pen.setWidthF(2);
461 466 q->setPen(pen);
462 467 }
463 468
464 469 if (forced || QChartPrivate::defaultBrush() == m_brush) {
465 470 QBrush brush(colors.at(index % colors.size()));
466 471 q->setBrush(brush);
467 472 }
468 473 }
469 474
470 475
471 476 #include "moc_qareaseries.cpp"
472 477 #include "moc_qareaseries_p.cpp"
473 478
474 479 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,673 +1,678
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qbarset.h"
22 22 #include "qbarset_p.h"
23 23 #include "charthelpers_p.h"
24 24 #include "qchart_p.h"
25 25
26 26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 27
28 28 /*!
29 29 \class QBarSet
30 30 \inmodule Qt Charts
31 31 \brief Building block for different bar charts.
32 32
33 33 QBarSet represents one set of bars. Set of bars contains one data value for each category.
34 34 First value of set is assumed to belong to first category, second to second category and so on.
35 35 If set has fewer values than there are categories, then the missing values are assumed to be
36 36 at the end of set. For missing values in middle of a set, numerical value of zero is used.
37 37
38 38 \mainclass
39 39
40 40 \sa QAbstractBarSeries, QBarSeries, QStackedBarSeries, QPercentBarSeries
41 41 */
42 42 #ifdef QDOC_QT5
43 43 /*!
44 44 \qmltype BarSet
45 45 \instantiates QBarSet
46 46 \inqmlmodule QtCommercial.Chart
47 47
48 48 \include doc/src/barset.qdocinc
49 49 */
50 50 #else
51 51 /*!
52 52 \qmlclass BarSet QBarSet
53 53
54 54 \include ../doc/src/barset.qdocinc
55 55 */
56 56 #endif
57 57
58 58 /*!
59 59 \property QBarSet::label
60 60 Defines the label of the bar set.
61 61 */
62 62 /*!
63 63 \qmlproperty string BarSet::label
64 64 Defines the label of the bar set.
65 65 */
66 66
67 67 /*!
68 68 \property QBarSet::pen
69 69 \brief Defines the pen used by the bar set.
70 70 */
71 71
72 72 /*!
73 73 \property QBarSet::brush
74 74 \brief Defines the brush used by the bar set.
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 83 \property QBarSet::labelBrush
79 84 \brief Defines the brush used by the bar set's label.
80 85 */
81 86
82 87 /*!
83 88 \property QBarSet::labelFont
84 89 \brief Defines the font used by the bar set's label.
85 90 */
86 91
87 92 /*!
88 93 \qmlproperty Font BarSet::labelFont
89 94 Defines the font used by the bar set's label.
90 95
91 96 See the Qt documentation for more details of Font.
92 97 */
93 98
94 99 /*!
95 100 \property QBarSet::color
96 101 The fill (brush) color of the bar set.
97 102 */
98 103 /*!
99 104 \qmlproperty color BarSet::color
100 105 The fill (brush) color of the bar set.
101 106 */
102 107
103 108 /*!
104 109 \property QBarSet::borderColor
105 110 The line (pen) color of the bar set.
106 111 */
107 112 /*!
108 113 \qmlproperty color BarSet::borderColor
109 114 The line (pen) color of the bar set.
110 115 */
111 116
112 117 /*!
113 118 \qmlproperty real BarSet::borderWidth
114 119 The width of the border line. By default the width is 2.0.
115 120 */
116 121
117 122 /*!
118 123 \property QBarSet::labelColor
119 124 The text (label) color of the bar set.
120 125 */
121 126 /*!
122 127 \qmlproperty color BarSet::labelColor
123 128 The text (label) color of the bar set.
124 129 */
125 130
126 131 /*!
127 132 \fn void QBarSet::clicked(int index)
128 133
129 134 The signal is emitted if the user clicks with a mouse on top of bar set.
130 135 Clicked bar inside set is indexed by \a index
131 136 */
132 137
133 138 /*!
134 139 \fn void QBarSet::hovered(bool status)
135 140
136 141 The signal is emitted if mouse is hovered on top of bar set.
137 142 Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set.
138 143 */
139 144
140 145 /*!
141 146 \fn void QBarSet::hovered(bool status, int index)
142 147
143 148 The signal is emitted if mouse is hovered on top of bar set.
144 149 Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set.
145 150 Hovered bar inside the set is indexed by \a index.
146 151 */
147 152
148 153
149 154 /*!
150 155 \fn void QBarSet::labelChanged()
151 156 This signal is emitted when the label of the bar set has changed.
152 157 \sa label
153 158 */
154 159 /*!
155 160 \qmlsignal BarSet::onLabelChanged()
156 161 This signal is emitted when the label of the bar set has changed.
157 162 */
158 163
159 164 /*!
160 165 \fn void QBarSet::penChanged()
161 166 This signal is emitted when the pen of the bar set has changed.
162 167 \sa pen
163 168 */
164 169
165 170 /*!
166 171 \fn void QBarSet::brushChanged()
167 172 This signal is emitted when the brush of the bar set has changed.
168 173 \sa brush
169 174 */
170 175
171 176 /*!
172 177 \fn void QBarSet::labelBrushChanged()
173 178 This signal is emitted when the brush of the bar set's label has changed.
174 179 \sa labelBrush
175 180 */
176 181
177 182 /*!
178 183 \fn void QBarSet::labelFontChanged()
179 184 This signal is emitted when the font of the bar set's label has changed.
180 185 \sa labelBrush
181 186 */
182 187
183 188 /*!
184 189 \fn void QBarSet::colorChanged(QColor)
185 190 This signal is emitted when the fill (brush) color of the set has changed to \a color.
186 191 */
187 192 /*!
188 193 \qmlsignal BarSet::onColorChanged(color color)
189 194 This signal is emitted when the fill (brush) color of the set has changed to \a color.
190 195 */
191 196
192 197 /*!
193 198 \fn void QBarSet::borderColorChanged(QColor)
194 199 This signal is emitted when the line (pen) color of the set has changed to \a color.
195 200 */
196 201 /*!
197 202 \qmlsignal BarSet::onBorderColorChanged(color color)
198 203 This signal is emitted when the line (pen) color of the set has changed to \a color.
199 204 */
200 205
201 206 /*!
202 207 \fn void QBarSet::labelColorChanged(QColor)
203 208 This signal is emitted when the text (label) color of the set has changed to \a color.
204 209 */
205 210 /*!
206 211 \qmlsignal BarSet::onLabelColorChanged(color color)
207 212 This signal is emitted when the text (label) color of the set has changed to \a color.
208 213 */
209 214
210 215 /*!
211 216 \fn void QBarSet::valuesAdded(int index, int count)
212 217 This signal is emitted when new values have been added to the set.
213 218 Parameter \a index indicates the position of the first inserted value.
214 219 Parameter \a count is the number of inserted values.
215 220 \sa append(), insert()
216 221 */
217 222 /*!
218 223 \qmlsignal BarSet::onValuesAdded(int index, int count)
219 224 This signal is emitted when new values have been added to the set.
220 225 Parameter \a index indicates the position of the first inserted value.
221 226 Parameter \a count is the number of inserted values.
222 227 */
223 228
224 229 /*!
225 230 \fn void QBarSet::valuesRemoved(int index, int count)
226 231 This signal is emitted values have been removed from the set.
227 232 Parameter \a index indicates the position of the first removed value.
228 233 Parameter \a count is the number of removed values.
229 234 \sa remove()
230 235 */
231 236 /*!
232 237 \qmlsignal BarSet::onValuesRemoved(int index, int count)
233 238 This signal is emitted values have been removed from the set.
234 239 Parameter \a index indicates the position of the first removed value.
235 240 Parameter \a count is the number of removed values.
236 241 */
237 242
238 243 /*!
239 244 \fn void QBarSet::valueChanged(int index)
240 245 This signal is emitted values the value in the set has been modified.
241 246 Parameter \a index indicates the position of the modified value.
242 247 \sa at()
243 248 */
244 249 /*!
245 250 \qmlsignal BarSet::onValueChanged(int index)
246 251 This signal is emitted values the value in the set has been modified.
247 252 Parameter \a index indicates the position of the modified value.
248 253 */
249 254
250 255 /*!
251 256 \qmlproperty int BarSet::count
252 257 The count of values on the bar set
253 258 */
254 259
255 260 /*!
256 261 \qmlproperty QVariantList BarSet::values
257 262 The values of the bar set. You can set either a list of reals or a list of points as values. If you set a list of
258 263 reals as values, the values are automatically completed to points by using the index of a value as it's
259 264 x-coordinate. For example the following sets have equal values:
260 265 \code
261 266 myBarSet1.values = [0, 5, 1, 5];
262 267 myBarSet2.values = [Qt.point(0, 0), Qt.point(1, 5), Qt.point(2, 1), Qt.point(3, 5)];
263 268 \endcode
264 269 */
265 270
266 271 /*!
267 272 Constructs QBarSet with a label of \a label and with parent of \a parent.
268 273 */
269 274 QBarSet::QBarSet(const QString label, QObject *parent)
270 275 : QObject(parent),
271 276 d_ptr(new QBarSetPrivate(label, this))
272 277 {
273 278 }
274 279
275 280 /*!
276 281 Destroys the bar set.
277 282 */
278 283 QBarSet::~QBarSet()
279 284 {
280 285 // NOTE: d_ptr destroyed by QObject
281 286 }
282 287
283 288 /*!
284 289 Sets new \a label for set.
285 290 */
286 291 void QBarSet::setLabel(const QString label)
287 292 {
288 293 d_ptr->m_label = label;
289 294 emit labelChanged();
290 295 }
291 296
292 297 /*!
293 298 Returns label of the set.
294 299 */
295 300 QString QBarSet::label() const
296 301 {
297 302 return d_ptr->m_label;
298 303 }
299 304
300 305 /*!
301 306 Appends new value \a value to the end of set.
302 307 */
303 308 void QBarSet::append(const qreal value)
304 309 {
305 310 // Convert to QPointF
306 311 int index = d_ptr->m_values.count();
307 312 d_ptr->append(QPointF(d_ptr->m_values.count(), value));
308 313 emit valuesAdded(index, 1);
309 314 }
310 315
311 316 /*!
312 317 Appends a list of reals to set. Works like append with single real value. The \a values in list
313 318 are appended to end of bar set.
314 319 \sa append()
315 320 */
316 321 void QBarSet::append(const QList<qreal> &values)
317 322 {
318 323 int index = d_ptr->m_values.count();
319 324 d_ptr->append(values);
320 325 emit valuesAdded(index, values.count());
321 326 }
322 327
323 328 /*!
324 329 Convenience operator. Same as append, with real \a value.
325 330 \sa append()
326 331 */
327 332 QBarSet &QBarSet::operator << (const qreal &value)
328 333 {
329 334 append(value);
330 335 return *this;
331 336 }
332 337
333 338 /*!
334 339 Inserts new \a value on the \a index position.
335 340 The value that is currently at this postion is moved to position index + 1
336 341 \sa remove()
337 342 */
338 343 void QBarSet::insert(const int index, const qreal value)
339 344 {
340 345 d_ptr->insert(index, value);
341 346 emit valuesAdded(index, 1);
342 347 }
343 348
344 349 /*!
345 350 Removes \a count number of values from the set starting at \a index.
346 351 \sa insert()
347 352 */
348 353 void QBarSet::remove(const int index, const int count)
349 354 {
350 355 int removedCount = d_ptr->remove(index, count);
351 356 if (removedCount > 0)
352 357 emit valuesRemoved(index, removedCount);
353 358 return;
354 359 }
355 360
356 361 /*!
357 362 Sets a new value \a value to set, indexed by \a index.
358 363 */
359 364 void QBarSet::replace(const int index, const qreal value)
360 365 {
361 366 if (index >= 0 && index < d_ptr->m_values.count()) {
362 367 d_ptr->replace(index, value);
363 368 emit valueChanged(index);
364 369 }
365 370 }
366 371
367 372
368 373 /*!
369 374 Returns value of set indexed by \a index.
370 375 If the index is out of bounds 0.0 is returned.
371 376 */
372 377 qreal QBarSet::at(const int index) const
373 378 {
374 379 if (index < 0 || index >= d_ptr->m_values.count())
375 380 return 0;
376 381 return d_ptr->m_values.at(index).y();
377 382 }
378 383
379 384 /*!
380 385 Returns value of set indexed by \a index.
381 386 If the index is out of bounds 0.0 is returned.
382 387 */
383 388 qreal QBarSet::operator [](const int index) const
384 389 {
385 390 return at(index);
386 391 }
387 392
388 393 /*!
389 394 Returns count of values in set.
390 395 */
391 396 int QBarSet::count() const
392 397 {
393 398 return d_ptr->m_values.count();
394 399 }
395 400
396 401 /*!
397 402 Returns sum of all values in the bar set.
398 403 */
399 404 qreal QBarSet::sum() const
400 405 {
401 406 qreal total(0);
402 407 for (int i = 0; i < d_ptr->m_values.count(); i++)
403 408 total += d_ptr->m_values.at(i).y();
404 409 return total;
405 410 }
406 411
407 412 /*!
408 413 Sets pen for set. Bars of this set are drawn using \a pen
409 414 */
410 415 void QBarSet::setPen(const QPen &pen)
411 416 {
412 417 if (d_ptr->m_pen != pen) {
413 418 d_ptr->m_pen = pen;
414 419 emit d_ptr->updatedBars();
415 420 emit penChanged();
416 421 }
417 422 }
418 423
419 424 /*!
420 425 Returns pen of the set.
421 426 */
422 427 QPen QBarSet::pen() const
423 428 {
424 429 if (d_ptr->m_pen == QChartPrivate::defaultPen())
425 430 return QPen();
426 431 else
427 432 return d_ptr->m_pen;
428 433 }
429 434
430 435 /*!
431 436 Sets brush for the set. Bars of this set are drawn using \a brush.
432 437 */
433 438 void QBarSet::setBrush(const QBrush &brush)
434 439 {
435 440 if (d_ptr->m_brush != brush) {
436 441 d_ptr->m_brush = brush;
437 442 emit d_ptr->updatedBars();
438 443 emit brushChanged();
439 444 }
440 445 }
441 446
442 447 /*!
443 448 Returns brush of the set.
444 449 */
445 450 QBrush QBarSet::brush() const
446 451 {
447 452 if (d_ptr->m_brush == QChartPrivate::defaultBrush())
448 453 return QBrush();
449 454 else
450 455 return d_ptr->m_brush;
451 456 }
452 457
453 458 /*!
454 459 Sets \a brush of the values that are drawn on top of this bar set.
455 460 */
456 461 void QBarSet::setLabelBrush(const QBrush &brush)
457 462 {
458 463 if (d_ptr->m_labelBrush != brush) {
459 464 d_ptr->m_labelBrush = brush;
460 465 emit d_ptr->updatedBars();
461 466 emit labelBrushChanged();
462 467 }
463 468 }
464 469
465 470 /*!
466 471 Returns brush of the values that are drawn on top of this bar set.
467 472 */
468 473 QBrush QBarSet::labelBrush() const
469 474 {
470 475 if (d_ptr->m_labelBrush == QChartPrivate::defaultBrush())
471 476 return QBrush();
472 477 else
473 478 return d_ptr->m_labelBrush;
474 479 }
475 480
476 481 /*!
477 482 Sets the \a font for values that are drawn on top of this bar set.
478 483 */
479 484 void QBarSet::setLabelFont(const QFont &font)
480 485 {
481 486 if (d_ptr->m_labelFont != font) {
482 487 d_ptr->m_labelFont = font;
483 488 emit d_ptr->updatedBars();
484 489 emit labelFontChanged();
485 490 }
486 491
487 492 }
488 493
489 494 /*!
490 495 Returns the pen for values that are drawn on top of this bar set.
491 496 */
492 497 QFont QBarSet::labelFont() const
493 498 {
494 499 return d_ptr->m_labelFont;
495 500 }
496 501
497 502 /*!
498 503 Returns the color of the brush of bar set.
499 504 */
500 505 QColor QBarSet::color()
501 506 {
502 507 return brush().color();
503 508 }
504 509
505 510 /*!
506 511 Sets the \a color of brush for this bar set.
507 512 */
508 513 void QBarSet::setColor(QColor color)
509 514 {
510 515 QBrush b = brush();
511 516 if ((b.color() != color) || (b.style() == Qt::NoBrush)) {
512 517 b.setColor(color);
513 518 if (b.style() == Qt::NoBrush) {
514 519 // Set tyle to Qt::SolidPattern. (Default is Qt::NoBrush)
515 520 // This prevents theme to override color defined in QML side:
516 521 // BarSet { label: "Bob"; color:"red"; values: [1,2,3] }
517 522 // The color must be obeyed, since user wanted it.
518 523 b.setStyle(Qt::SolidPattern);
519 524 }
520 525 setBrush(b);
521 526 emit colorChanged(color);
522 527 }
523 528 }
524 529
525 530 /*!
526 531 Returns the color of pen of this bar set.
527 532 */
528 533 QColor QBarSet::borderColor()
529 534 {
530 535 return pen().color();
531 536 }
532 537
533 538 /*!
534 539 Sets the color of pen for this bar set.
535 540 */
536 541 void QBarSet::setBorderColor(QColor color)
537 542 {
538 543 QPen p = pen();
539 544 if (p.color() != color) {
540 545 p.setColor(color);
541 546 setPen(p);
542 547 emit borderColorChanged(color);
543 548 }
544 549 }
545 550
546 551 /*!
547 552 Returns the color of labels of this bar set.
548 553 */
549 554 QColor QBarSet::labelColor()
550 555 {
551 556 return labelBrush().color();
552 557 }
553 558
554 559 /*!
555 560 Sets the color of labels for this bar set.
556 561 */
557 562 void QBarSet::setLabelColor(QColor color)
558 563 {
559 564 QBrush b = labelBrush();
560 565 if (b == QBrush())
561 566 b.setStyle(Qt::SolidPattern);
562 567
563 568 if (b.color() != color) {
564 569 b.setColor(color);
565 570 setLabelBrush(b);
566 571 emit labelColorChanged(color);
567 572 }
568 573 }
569 574
570 575 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
571 576
572 577 QBarSetPrivate::QBarSetPrivate(const QString label, QBarSet *parent) : QObject(parent),
573 578 q_ptr(parent),
574 579 m_label(label),
575 580 m_pen(QChartPrivate::defaultPen()),
576 581 m_brush(QChartPrivate::defaultBrush()),
577 582 m_labelBrush(QChartPrivate::defaultBrush())
578 583 {
579 584 }
580 585
581 586 QBarSetPrivate::~QBarSetPrivate()
582 587 {
583 588 }
584 589
585 590 void QBarSetPrivate::append(QPointF value)
586 591 {
587 592 if (isValidValue(value)) {
588 593 m_values.append(value);
589 594 emit restructuredBars();
590 595 }
591 596 }
592 597
593 598 void QBarSetPrivate::append(QList<QPointF> values)
594 599 {
595 600 for (int i = 0; i < values.count(); i++) {
596 601 if (isValidValue(values.at(i)))
597 602 m_values.append(values.at(i));
598 603 }
599 604 emit restructuredBars();
600 605 }
601 606
602 607 void QBarSetPrivate::append(QList<qreal> values)
603 608 {
604 609 int index = m_values.count();
605 610 for (int i = 0; i < values.count(); i++) {
606 611 if (isValidValue(values.at(i))) {
607 612 m_values.append(QPointF(index, values.at(i)));
608 613 index++;
609 614 }
610 615 }
611 616 emit restructuredBars();
612 617 }
613 618
614 619 void QBarSetPrivate::insert(const int index, const qreal value)
615 620 {
616 621 m_values.insert(index, QPointF(index, value));
617 622 emit restructuredBars();
618 623 }
619 624
620 625 void QBarSetPrivate::insert(const int index, const QPointF value)
621 626 {
622 627 m_values.insert(index, value);
623 628 emit restructuredBars();
624 629 }
625 630
626 631 int QBarSetPrivate::remove(const int index, const int count)
627 632 {
628 633 int removeCount = count;
629 634
630 635 if ((index < 0) || (m_values.count() == 0))
631 636 return 0; // Invalid index or not values in list, remove nothing.
632 637 else if ((index + count) > m_values.count())
633 638 removeCount = m_values.count() - index; // Trying to remove more items than list has. Limit amount to be removed.
634 639
635 640 int c = 0;
636 641 while (c < removeCount) {
637 642 m_values.removeAt(index);
638 643 c++;
639 644 }
640 645 emit restructuredBars();
641 646 return removeCount;
642 647 }
643 648
644 649 void QBarSetPrivate::replace(const int index, const qreal value)
645 650 {
646 651 m_values.replace(index, QPointF(index, value));
647 652 emit updatedLayout();
648 653 }
649 654
650 655 void QBarSetPrivate::replace(const int index, const QPointF value)
651 656 {
652 657 m_values.replace(index, value);
653 658 emit updatedLayout();
654 659 }
655 660
656 661 qreal QBarSetPrivate::pos(const int index)
657 662 {
658 663 if (index < 0 || index >= m_values.count())
659 664 return 0;
660 665 return m_values.at(index).x();
661 666 }
662 667
663 668 qreal QBarSetPrivate::value(const int index)
664 669 {
665 670 if (index < 0 || index >= m_values.count())
666 671 return 0;
667 672 return m_values.at(index).y();
668 673 }
669 674
670 675 #include "moc_qbarset.cpp"
671 676 #include "moc_qbarset_p.cpp"
672 677
673 678 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,680 +1,686
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qboxplotseries.h"
22 22 #include "qboxplotseries_p.h"
23 23 #include "qboxplotlegendmarker.h"
24 24 #include "qbarcategoryaxis.h"
25 25 #include "boxplotchartitem_p.h"
26 26 #include "chartdataset_p.h"
27 27 #include "charttheme_p.h"
28 28 #include "qvalueaxis.h"
29 29 #include "charttheme_p.h"
30 30 #include "boxplotanimation_p.h"
31 31 #include "qchart_p.h"
32 32 #include "qboxset.h"
33 33 #include "qboxset_p.h"
34 34
35 35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 36
37 37 /*!
38 38 \class QBoxPlotSeries
39 39 \inmodule Qt Charts
40 40 \brief Series for creating box-and-whiskers chart
41 41 \mainclass
42 42
43 43 QBoxPlotSeries represents a series of data shown as box-and-whisker bars. The purpose of this class is to act as
44 44 a container for single box-and-whisker items. Each item is drawn to own slot. If chart includes multiple instances of
45 45 QBoxPlotSeries then box-and-whiskers items with the same index are drawn to same slot.
46 46
47 47 See the \l {Box and Whiskers Example} {box-and-whiskers chart example} to learn how to create a box-and-whiskers chart.
48 48 \image examples_boxplotchart.png
49 49
50 50 \sa QBoxSet
51 51 */
52 52 /*!
53 53 \fn QBoxPlotSeries::boxsetsAdded(QList<QBoxSet *> sets)
54 54 \brief Signal is emitted when a new \a sets of box-and-whiskers data is added to the series.
55 55 */
56 56 /*!
57 57 \fn QBoxPlotSeries::boxsetsRemoved(QList<QBoxSet *> sets)
58 58 \brief Signal is emitted when \a sets of box-and-whiskers data is removed from the series.
59 59 */
60 60 /*!
61 61 \fn QBoxPlotSeries::clicked(QBoxSet *boxset)
62 62 \brief Signal is emitted when the user clicks the \a boxset on the chart.
63 63 */
64 64 /*!
65 65 \fn QBoxPlotSeries::hovered(bool status, QBoxSet *boxset)
66 66 \brief Signal is emitted when there is change in hover \a status over \a boxset.
67 67 */
68 68 /*!
69 69 \fn QBoxPlotSeries::countChanged()
70 70 \brief Signal is emitted when there is change in count of box-and-whiskers items in the series.
71 71 */
72 72 /*!
73 73 \property QBoxPlotSeries::boxOutlineVisible
74 74 \brief This property configures the visibility of the middle box outline.
75 75 */
76 76 /*!
77 77 \property QBoxPlotSeries::boxWidth
78 78 \brief This property configures the width of the box-and-whiskers item. The value signifies the relative
79 79 width of the box-and-whiskers item inside its own slot. The value can between 0.0 and 1.0. Negative values
80 80 are clamped to 0.0 and values over 1.0 are clamped to 1.0.
81 81 */
82 82 /*!
83 83 \property QBoxPlotSeries::pen
84 84 \brief This property configures the pen of the box-and-whiskers items.
85 85 */
86 86 /*!
87 87 \property QBoxPlotSeries::brush
88 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 97 \fn void QBoxPlotSeries::boxOutlineVisibilityChanged()
92 98 Signal is emitted when the middle box outline visibility is changed.
93 99 */
94 100 /*!
95 101 \fn void QBoxPlotSeries::boxWidthChanged()
96 102 Signal is emitted when the width of the box-and-whiskers item is changed.
97 103 */
98 104 /*!
99 105 \fn void QBoxPlotSeries::penChanged()
100 106 This signal is emitted when the pen of the box-and-whiskers has changed.
101 107 \sa brush
102 108 */
103 109 /*!
104 110 \fn void QBoxPlotSeries::brushChanged()
105 111 This signal is emitted when the brush of the box-and-whiskers has changed.
106 112 \sa brush
107 113 */
108 114 /*!
109 115 \fn virtual SeriesType QBoxPlotSeries::type() const
110 116 \brief Returns type of series.
111 117 \sa QAbstractSeries, SeriesType
112 118 */
113 119
114 120 /*!
115 121 Constructs empty QBoxPlotSeries.
116 122 QBoxPlotSeries is QObject which is a child of a \a parent.
117 123 */
118 124 QBoxPlotSeries::QBoxPlotSeries(QObject *parent)
119 125 : QAbstractSeries(*new QBoxPlotSeriesPrivate(this), parent)
120 126 {
121 127 }
122 128
123 129 /*!
124 130 Destructor. Removes series from chart.
125 131 */
126 132 QBoxPlotSeries::~QBoxPlotSeries()
127 133 {
128 134 Q_D(QBoxPlotSeries);
129 135 if (d->m_chart)
130 136 d->m_chart->removeSeries(this);
131 137 }
132 138
133 139 /*!
134 140 Adds a single box and whiskers set to series. Takes ownership of the \a set. If the set is null or is already in series, it won't be appended.
135 141 Returns true, if appending succeeded.
136 142 */
137 143 bool QBoxPlotSeries::append(QBoxSet *set)
138 144 {
139 145 Q_D(QBoxPlotSeries);
140 146
141 147 bool success = d->append(set);
142 148 if (success) {
143 149 QList<QBoxSet *> sets;
144 150 sets.append(set);
145 151 set->setParent(this);
146 152 emit boxsetsAdded(sets);
147 153 emit countChanged();
148 154 }
149 155 return success;
150 156 }
151 157
152 158 /*!
153 159 Removes boxset from the series. Deletes the \a set and returns true if successful.
154 160 */
155 161 bool QBoxPlotSeries::remove(QBoxSet *set)
156 162 {
157 163 Q_D(QBoxPlotSeries);
158 164 bool success = d->remove(set);
159 165 if (success) {
160 166 QList<QBoxSet *> sets;
161 167 sets.append(set);
162 168 set->setParent(0);
163 169 emit boxsetsRemoved(sets);
164 170 emit countChanged();
165 171 delete set;
166 172 set = 0;
167 173 }
168 174 return success;
169 175 }
170 176
171 177 /*!
172 178 Takes a single \a set from the series. Does not delete the boxset object.
173 179
174 180 NOTE: The series remains as the boxset's parent object. You must set the
175 181 parent object to take full ownership.
176 182
177 183 Returns true if take was successful.
178 184 */
179 185 bool QBoxPlotSeries::take(QBoxSet *set)
180 186 {
181 187 Q_D(QBoxPlotSeries);
182 188
183 189 bool success = d->remove(set);
184 190 if (success) {
185 191 QList<QBoxSet *> sets;
186 192 sets.append(set);
187 193 emit boxsetsRemoved(sets);
188 194 emit countChanged();
189 195 }
190 196 return success;
191 197 }
192 198
193 199 /*!
194 200 Adds a list of boxsets to series. Takes ownership of the \a sets.
195 201 Returns true, if all sets were appended successfully. If any of the sets is null or is already appended to series,
196 202 nothing is appended and function returns false. If any of the sets is in list more than once, nothing is appended
197 203 and function returns false.
198 204 */
199 205 bool QBoxPlotSeries::append(QList<QBoxSet *> sets)
200 206 {
201 207 Q_D(QBoxPlotSeries);
202 208 bool success = d->append(sets);
203 209 if (success) {
204 210 emit boxsetsAdded(sets);
205 211 emit countChanged();
206 212 }
207 213 return success;
208 214 }
209 215
210 216 /*!
211 217 Insert a box-and-whiskers set to the series at \a index postion. Takes ownership of the \a set. If the set is null or
212 218 is already in series, it won't be appended. Returns true, if inserting succeeded.
213 219
214 220 */
215 221 bool QBoxPlotSeries::insert(int index, QBoxSet *set)
216 222 {
217 223 Q_D(QBoxPlotSeries);
218 224 bool success = d->insert(index, set);
219 225 if (success) {
220 226 QList<QBoxSet *> sets;
221 227 sets.append(set);
222 228 emit boxsetsAdded(sets);
223 229 emit countChanged();
224 230 }
225 231 return success;
226 232 }
227 233
228 234 /*!
229 235 Removes all boxsets from the series. Deletes removed sets.
230 236 */
231 237 void QBoxPlotSeries::clear()
232 238 {
233 239 Q_D(QBoxPlotSeries);
234 240 QList<QBoxSet *> sets = boxSets();
235 241 bool success = d->remove(sets);
236 242 if (success) {
237 243 emit boxsetsRemoved(sets);
238 244 emit countChanged();
239 245 foreach (QBoxSet *set, sets)
240 246 delete set;
241 247 }
242 248 }
243 249
244 250 /*!
245 251 Returns number of sets in series.
246 252 */
247 253 int QBoxPlotSeries::count() const
248 254 {
249 255 Q_D(const QBoxPlotSeries);
250 256 return d->m_boxSets.count();
251 257 }
252 258
253 259 /*!
254 260 Returns a list of sets in series. Keeps ownership of sets.
255 261 */
256 262 QList<QBoxSet *> QBoxPlotSeries::boxSets() const
257 263 {
258 264 Q_D(const QBoxPlotSeries);
259 265 return d->m_boxSets;
260 266 }
261 267
262 268 /*
263 269 Returns QAbstractSeries::SeriesTypeBoxPlot.
264 270 */
265 271 QAbstractSeries::SeriesType QBoxPlotSeries::type() const
266 272 {
267 273 return QAbstractSeries::SeriesTypeBoxPlot;
268 274 }
269 275
270 276 void QBoxPlotSeries::setBoxOutlineVisible(bool visible)
271 277 {
272 278 Q_D(QBoxPlotSeries);
273 279
274 280 if (d->m_boxOutlineVisible != visible) {
275 281 d->m_boxOutlineVisible = visible;
276 282 emit d->updated();
277 283 emit boxOutlineVisibilityChanged();
278 284 }
279 285 }
280 286
281 287 bool QBoxPlotSeries::boxOutlineVisible()
282 288 {
283 289 Q_D(QBoxPlotSeries);
284 290
285 291 return d->m_boxOutlineVisible;
286 292 }
287 293
288 294 void QBoxPlotSeries::setBoxWidth(qreal width)
289 295 {
290 296 Q_D(QBoxPlotSeries);
291 297
292 298 if (width != d->m_boxWidth) {
293 299 if (width < 0.0)
294 300 width = 0.0;
295 301 if (width > 1.0)
296 302 width = 1.0;
297 303 d->m_boxWidth = width;
298 304 emit d->updatedLayout();
299 305 emit boxWidthChanged();
300 306 }
301 307 }
302 308
303 309 qreal QBoxPlotSeries::boxWidth()
304 310 {
305 311 Q_D(QBoxPlotSeries);
306 312
307 313 return d->m_boxWidth;
308 314 }
309 315
310 316 void QBoxPlotSeries::setBrush(const QBrush &brush)
311 317 {
312 318 Q_D(QBoxPlotSeries);
313 319
314 320 if (d->m_brush != brush) {
315 321 d->m_brush = brush;
316 322 emit d->updated();
317 323 emit brushChanged();
318 324 }
319 325 }
320 326
321 327 QBrush QBoxPlotSeries::brush() const
322 328 {
323 329 Q_D(const QBoxPlotSeries);
324 330
325 331 return d->m_brush;
326 332 }
327 333
328 334 void QBoxPlotSeries::setPen(const QPen &pen)
329 335 {
330 336 Q_D(QBoxPlotSeries);
331 337
332 338 if (d->m_pen != pen) {
333 339 d->m_pen = pen;
334 340 emit d->updated();
335 341 emit penChanged();
336 342 }
337 343 }
338 344
339 345 QPen QBoxPlotSeries::pen() const
340 346 {
341 347 Q_D(const QBoxPlotSeries);
342 348
343 349 return d->m_pen;
344 350 }
345 351
346 352 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
347 353
348 354 QBoxPlotSeriesPrivate::QBoxPlotSeriesPrivate(QBoxPlotSeries *q)
349 355 : QAbstractSeriesPrivate(q),
350 356 m_pen(QChartPrivate::defaultPen()),
351 357 m_brush(QChartPrivate::defaultBrush()),
352 358 m_boxOutlineVisible(true),
353 359 m_boxWidth(0.5)
354 360 {
355 361 }
356 362
357 363 QBoxPlotSeriesPrivate::~QBoxPlotSeriesPrivate()
358 364 {
359 365 disconnect(this, 0, 0, 0);
360 366 }
361 367
362 368 void QBoxPlotSeriesPrivate::initializeDomain()
363 369 {
364 370 qreal minX(domain()->minX());
365 371 qreal minY(domain()->minY());
366 372 qreal maxX(domain()->maxX());
367 373 qreal maxY(domain()->maxY());
368 374
369 375 qreal x = m_boxSets.count();
370 376 minX = qMin(minX, qreal(-0.5));
371 377 minY = qMin(minY, min());
372 378 maxX = qMax(maxX, x - qreal(0.5));
373 379 maxY = qMax(maxY, max());
374 380
375 381 domain()->setRange(minX, maxX, minY, maxY);
376 382 }
377 383
378 384 void QBoxPlotSeriesPrivate::initializeAxes()
379 385 {
380 386 foreach (QAbstractAxis* axis, m_axes) {
381 387 if (axis->type() == QAbstractAxis::AxisTypeBarCategory) {
382 388 if (axis->orientation() == Qt::Horizontal)
383 389 populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
384 390 }
385 391 }
386 392 }
387 393
388 394 QAbstractAxis::AxisType QBoxPlotSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
389 395 {
390 396 if (orientation == Qt::Horizontal)
391 397 return QAbstractAxis::AxisTypeBarCategory;
392 398
393 399 return QAbstractAxis::AxisTypeValue;
394 400 }
395 401
396 402 QAbstractAxis* QBoxPlotSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
397 403 {
398 404 if (defaultAxisType(orientation) == QAbstractAxis::AxisTypeBarCategory)
399 405 return new QBarCategoryAxis;
400 406 else
401 407 return new QValueAxis;
402 408 }
403 409
404 410 void QBoxPlotSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
405 411 {
406 412 QStringList categories;
407 413 if (axis->categories().isEmpty()) {
408 414 for (int i(1); i < m_boxSets.count() + 1; i++) {
409 415 QBoxSet *set = m_boxSets.at(i - 1);
410 416 if (set->label().isEmpty())
411 417 categories << QString::number(i);
412 418 else
413 419 categories << set->label();
414 420 }
415 421 axis->append(categories);
416 422 }
417 423 }
418 424
419 425 void QBoxPlotSeriesPrivate::initializeGraphics(QGraphicsItem *parent)
420 426 {
421 427 Q_Q(QBoxPlotSeries);
422 428
423 429 BoxPlotChartItem *boxPlot = new BoxPlotChartItem(q, parent);
424 430 m_item.reset(boxPlot);
425 431 QAbstractSeriesPrivate::initializeGraphics(parent);
426 432
427 433 if (m_chart) {
428 434 connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesChange(QAbstractSeries*)) );
429 435 connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SLOT(handleSeriesRemove(QAbstractSeries*)) );
430 436
431 437 QList<QAbstractSeries *> serieses = m_chart->series();
432 438
433 439 // Tries to find this series from the Chart's list of series and deduce the index
434 440 int index = 0;
435 441 foreach (QAbstractSeries *s, serieses) {
436 442 if (s->type() == QAbstractSeries::SeriesTypeBoxPlot) {
437 443 if (q == static_cast<QBoxPlotSeries *>(s)) {
438 444 boxPlot->m_seriesIndex = index;
439 445 m_index = index;
440 446 }
441 447 index++;
442 448 }
443 449 }
444 450 boxPlot->m_seriesCount = index;
445 451 }
446 452
447 453 // Make BoxPlotChartItem to instantiate box & whisker items
448 454 boxPlot->handleDataStructureChanged();
449 455 }
450 456
451 457 void QBoxPlotSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
452 458 {
453 459 Q_Q(QBoxPlotSeries);
454 460
455 461 const QList<QGradient> gradients = theme->seriesGradients();
456 462
457 463 if (forced || QChartPrivate::defaultBrush() == m_brush) {
458 464 QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.5);
459 465 q->setBrush(brushColor);
460 466 }
461 467
462 468 if (forced || QChartPrivate::defaultPen() == m_pen) {
463 469 QPen pen = theme->outlinePen();
464 470 pen.setCosmetic(true);
465 471 q->setPen(pen);
466 472 }
467 473 }
468 474
469 475 void QBoxPlotSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
470 476 {
471 477 BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data());
472 478 Q_ASSERT(item);
473 479 if (item->animation())
474 480 item->animation()->stopAndDestroyLater();
475 481
476 482 if (options.testFlag(QChart::SeriesAnimations))
477 483 m_animation = new BoxPlotAnimation(item);
478 484 else
479 485 m_animation = 0;
480 486 item->setAnimation(m_animation);
481 487
482 488 QAbstractSeriesPrivate::initializeAnimations(options);
483 489 }
484 490
485 491 QList<QLegendMarker*> QBoxPlotSeriesPrivate::createLegendMarkers(QLegend *legend)
486 492 {
487 493 Q_Q(QBoxPlotSeries);
488 494 QList<QLegendMarker *> list;
489 495 return list << new QBoxPlotLegendMarker(q, legend);
490 496 }
491 497
492 498 void QBoxPlotSeriesPrivate::handleSeriesRemove(QAbstractSeries *series)
493 499 {
494 500 Q_Q(QBoxPlotSeries);
495 501
496 502 QBoxPlotSeries *removedSeries = static_cast<QBoxPlotSeries *>(series);
497 503
498 504 if (q == removedSeries && m_animation) {
499 505 m_animation->stopAll();
500 506 QObject::disconnect(m_chart->d_ptr->m_dataset, 0, removedSeries->d_func(), 0);
501 507 }
502 508
503 509 // Test if series removed is me, then don't do anything
504 510 if (q != removedSeries) {
505 511 BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data());
506 512 if (item) {
507 513 item->m_seriesCount = item->m_seriesCount - 1;
508 514 if (removedSeries->d_func()->m_index < m_index) {
509 515 m_index--;
510 516 item->m_seriesIndex = m_index;
511 517 }
512 518
513 519 item->handleDataStructureChanged();
514 520 }
515 521 }
516 522 }
517 523
518 524 void QBoxPlotSeriesPrivate::handleSeriesChange(QAbstractSeries *series)
519 525 {
520 526 Q_UNUSED(series);
521 527
522 528 Q_Q(QBoxPlotSeries);
523 529
524 530 BoxPlotChartItem *boxPlot = static_cast<BoxPlotChartItem *>(m_item.data());
525 531
526 532 if (m_chart) {
527 533 QList<QAbstractSeries *> serieses = m_chart->series();
528 534
529 535 // Tries to find this series from the Chart's list of series and deduce the index
530 536 int index = 0;
531 537 foreach (QAbstractSeries *s, serieses) {
532 538 if (s->type() == QAbstractSeries::SeriesTypeBoxPlot) {
533 539 if (q == static_cast<QBoxPlotSeries *>(s)) {
534 540 boxPlot->m_seriesIndex = index;
535 541 m_index = index;
536 542 }
537 543 index++;
538 544 }
539 545 }
540 546 boxPlot->m_seriesCount = index;
541 547 }
542 548
543 549 boxPlot->handleDataStructureChanged();
544 550 }
545 551
546 552 bool QBoxPlotSeriesPrivate::append(QBoxSet *set)
547 553 {
548 554 if (m_boxSets.contains(set) || (set == 0) || set->d_ptr->m_series)
549 555 return false; // Fail if set is already in list or set is null.
550 556
551 557 m_boxSets.append(set);
552 558 QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
553 559 QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
554 560 QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
555 561 set->d_ptr->m_series = this;
556 562
557 563 emit restructuredBoxes(); // this notifies boxplotchartitem
558 564 return true;
559 565 }
560 566
561 567 bool QBoxPlotSeriesPrivate::remove(QBoxSet *set)
562 568 {
563 569 if (!m_boxSets.contains(set))
564 570 return false; // Fail if set is not in list
565 571
566 572 set->d_ptr->m_series = 0;
567 573 m_boxSets.removeOne(set);
568 574 QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
569 575 QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
570 576 QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
571 577
572 578 emit restructuredBoxes(); // this notifies boxplotchartitem
573 579 return true;
574 580 }
575 581
576 582 bool QBoxPlotSeriesPrivate::append(QList<QBoxSet *> sets)
577 583 {
578 584 foreach (QBoxSet *set, sets) {
579 585 if ((set == 0) || m_boxSets.contains(set) || set->d_ptr->m_series)
580 586 return false; // Fail if any of the sets is null or is already appended.
581 587 if (sets.count(set) != 1)
582 588 return false; // Also fail if same set is more than once in given list.
583 589 }
584 590
585 591 foreach (QBoxSet *set, sets) {
586 592 m_boxSets.append(set);
587 593 QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
588 594 QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
589 595 QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
590 596 set->d_ptr->m_series = this;
591 597 }
592 598
593 599 emit restructuredBoxes(); // this notifies boxplotchartitem
594 600 return true;
595 601 }
596 602
597 603 bool QBoxPlotSeriesPrivate::remove(QList<QBoxSet *> sets)
598 604 {
599 605 if (sets.count() == 0)
600 606 return false;
601 607
602 608 foreach (QBoxSet *set, sets) {
603 609 if ((set == 0) || (!m_boxSets.contains(set)))
604 610 return false; // Fail if any of the sets is null or is not in series
605 611 if (sets.count(set) != 1)
606 612 return false; // Also fail if same set is more than once in given list.
607 613 }
608 614
609 615 foreach (QBoxSet *set, sets) {
610 616 set->d_ptr->m_series = 0;
611 617 m_boxSets.removeOne(set);
612 618 QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
613 619 QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
614 620 QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
615 621 }
616 622
617 623 emit restructuredBoxes(); // this notifies boxplotchartitem
618 624
619 625 return true;
620 626 }
621 627
622 628 bool QBoxPlotSeriesPrivate::insert(int index, QBoxSet *set)
623 629 {
624 630 if ((m_boxSets.contains(set)) || (set == 0) || set->d_ptr->m_series)
625 631 return false; // Fail if set is already in list or set is null.
626 632
627 633 m_boxSets.insert(index, set);
628 634 set->d_ptr->m_series = this;
629 635 QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
630 636 QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
631 637 QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
632 638
633 639 emit restructuredBoxes(); // this notifies boxplotchartitem
634 640 return true;
635 641 }
636 642
637 643 QBoxSet *QBoxPlotSeriesPrivate::boxSetAt(int index)
638 644 {
639 645 return m_boxSets.at(index);
640 646 }
641 647
642 648 qreal QBoxPlotSeriesPrivate::min()
643 649 {
644 650 if (m_boxSets.count() <= 0)
645 651 return 0;
646 652
647 653 qreal min = m_boxSets.at(0)->at(0);
648 654
649 655 foreach (QBoxSet *set, m_boxSets) {
650 656 for (int i = 0; i < 5; i++) {
651 657 if (set->at(i) < min)
652 658 min = set->at(i);
653 659 }
654 660 }
655 661
656 662 return min;
657 663 }
658 664
659 665 qreal QBoxPlotSeriesPrivate::max()
660 666 {
661 667 if (m_boxSets.count() <= 0)
662 668 return 0;
663 669
664 670 qreal max = m_boxSets.at(0)->at(0);
665 671
666 672 foreach (QBoxSet *set, m_boxSets) {
667 673 for (int i = 0; i < 5; i++) {
668 674 if (set->at(i) > max)
669 675 max = set->at(i);
670 676 }
671 677 }
672 678
673 679 return max;
674 680 }
675 681
676 682 #include "moc_qboxplotseries.cpp"
677 683 #include "moc_qboxplotseries_p.cpp"
678 684
679 685 QTCOMMERCIALCHART_END_NAMESPACE
680 686
@@ -1,330 +1,336
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qboxset.h"
22 22 #include "qboxset_p.h"
23 23 #include "charthelpers_p.h"
24 24
25 25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 26
27 27 /*!
28 28 \class QBoxSet
29 29 \inmodule Qt Charts
30 30 \brief Building block for box-and-whiskers chart
31 31
32 32 QBoxSet represents one box-and-whiskers item. It takes five values to create a graphical representation
33 33 of range and three medians. There are two ways to give the values. The first one is with constructor
34 34 or stream operator (<<). The values have to be given in the following order: lower extreme,
35 35 lower quartile, median, upper quartile and upper extreme. The Second method is to create an empty QBoxSet instance and
36 36 give the values using setValue method.
37 37
38 38 \mainclass
39 39
40 40 \sa QBoxPlotSeries
41 41 */
42 42 /*!
43 43 \enum QBoxSet::ValuePositions
44 44
45 45 \value LowerExtreme
46 46 \value LowerQuartile
47 47 \value Median
48 48 \value UpperQuartile
49 49 \value UpperExtreme
50 50 */
51 51 /*!
52 52 \property QBoxSet::pen
53 53 \brief Defines the pen used by the box-and-whiskers set.
54 54 */
55 55 /*!
56 56 \property QBoxSet::brush
57 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 66 \fn void QBoxSet::clicked()
61 67 The signal is emitted if the user clicks with a mouse on top of box-and-whisker item.
62 68 */
63 69 /*!
64 70 \fn void QBoxSet::hovered(bool status)
65 71
66 72 The signal is emitted if mouse is hovered on top of box-and-whisker item.
67 73 Parameter \a status is true, if mouse entered on top of item, false if mouse left from top of item.
68 74 */
69 75 /*!
70 76 \fn void QBoxSet::penChanged()
71 77 This signal is emitted when the pen of the box-and-whisker item has changed.
72 78 \sa pen
73 79 */
74 80 /*!
75 81 \fn void QBoxSet::brushChanged()
76 82 This signal is emitted when the brush of the box-and-whisker item has changed.
77 83 \sa brush
78 84 */
79 85 /*!
80 86 \fn void QBoxSet::valuesChanged()
81 87 This signal is emitted when multiple values have been changed on the box-and-whisker item.
82 88 \sa append()
83 89 */
84 90 /*!
85 91 \fn void QBoxSet::valueChanged(int index)
86 92 This signal is emitted values the value in the box-and-whisker item has been modified.
87 93 Parameter \a index indicates the position of the modified value.
88 94 \sa at()
89 95 */
90 96 /*!
91 97 \fn void QBoxSet::cleared()
92 98 This signal is emitted when all the values on the set are cleared to 0.
93 99 */
94 100
95 101 /*!
96 102 Constructs QBoxSet with optional \a label and parent of \a parent
97 103 */
98 104 QBoxSet::QBoxSet(const QString label, QObject *parent)
99 105 : QObject(parent),
100 106 d_ptr(new QBoxSetPrivate(label, this))
101 107 {
102 108 }
103 109
104 110 /*!
105 111 Constructs QBoxSet with given ordered values. \a le for lower extreme, \a lq for lower quartile, \a m for median,
106 112 \a uq for upper quartile and \a ue for upper quartile. \a label and \a parent are optional.
107 113 */
108 114 QBoxSet::QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label, QObject *parent)
109 115 : QObject(parent),
110 116 d_ptr(new QBoxSetPrivate(label, this))
111 117 {
112 118 d_ptr->append(le);
113 119 d_ptr->append(lq);
114 120 d_ptr->append(m);
115 121 d_ptr->append(uq);
116 122 d_ptr->append(ue);
117 123 }
118 124
119 125 /*!
120 126 Destroys the boxset
121 127 */
122 128 QBoxSet::~QBoxSet()
123 129 {
124 130 }
125 131
126 132 /*!
127 133 Appends new value \a value to the end of set.
128 134 */
129 135 void QBoxSet::append(const qreal value)
130 136 {
131 137 if (d_ptr->append(value))
132 138 emit valueChanged(d_ptr->m_appendCount - 1);
133 139 }
134 140
135 141 /*!
136 142 Appends a list of reals to set. Works like append with single real value. The \a values in list
137 143 are appended to end of boxset.
138 144 \sa append()
139 145 */
140 146 void QBoxSet::append(const QList<qreal> &values)
141 147 {
142 148 if (d_ptr->append(values))
143 149 emit valuesChanged();
144 150 }
145 151
146 152 /*!
147 153 Sets new \a label for set.
148 154 */
149 155 void QBoxSet::setLabel(const QString label)
150 156 {
151 157 d_ptr->m_label = label;
152 158 }
153 159
154 160 /*!
155 161 Returns label of the set.
156 162 */
157 163 QString QBoxSet::label() const
158 164 {
159 165 return d_ptr->m_label;
160 166 }
161 167
162 168 /*!
163 169 Convenience operator. Same as append, with real \a value.
164 170 \sa append()
165 171 */
166 172 QBoxSet &QBoxSet::operator << (const qreal &value)
167 173 {
168 174 append(value);
169 175 return *this;
170 176 }
171 177
172 178 /*!
173 179 Sets a new \a value on the \a index position. For \a index ValuePositions can be used.
174 180 */
175 181 void QBoxSet::setValue(const int index, const qreal value)
176 182 {
177 183 d_ptr->setValue(index, value);
178 184 emit valueChanged(index);
179 185 }
180 186
181 187 /*!
182 188 Sets all values on the set to 0.
183 189 */
184 190 void QBoxSet::clear()
185 191 {
186 192 d_ptr->clear();
187 193 emit cleared();
188 194 }
189 195
190 196 /*!
191 197 Returns value of set indexed by \a index. For \a index ValuePositions can be used.
192 198 If the index is out of bounds 0.0 is returned.
193 199 */
194 200 qreal QBoxSet::at(const int index) const
195 201 {
196 202 if (index < 0 || index >= 5)
197 203 return 0;
198 204 return d_ptr->m_values[index];
199 205 }
200 206
201 207 /*!
202 208 Returns value of set indexed by \a index. For \a index ValuePositions can be used.
203 209 If the index is out of bounds 0.0 is returned.
204 210 */
205 211 qreal QBoxSet::operator [](const int index) const
206 212 {
207 213 return at(index);
208 214 }
209 215
210 216 /*!
211 217 Returns count of values appended to the set.
212 218 */
213 219 int QBoxSet::count() const
214 220 {
215 221 return d_ptr->m_appendCount;
216 222 }
217 223
218 224 /*!
219 225 Sets pen for set. Boxes of this set are drawn using \a pen
220 226 */
221 227 void QBoxSet::setPen(const QPen &pen)
222 228 {
223 229 if (d_ptr->m_pen != pen) {
224 230 d_ptr->m_pen = pen;
225 231 emit d_ptr->updatedBox();
226 232 emit penChanged();
227 233 }
228 234 }
229 235
230 236 /*!
231 237 Returns pen of the set.
232 238 */
233 239 QPen QBoxSet::pen() const
234 240 {
235 241 return d_ptr->m_pen;
236 242 }
237 243
238 244 /*!
239 245 Sets brush for the set. Boxes of this set are drawn using \a brush
240 246 */
241 247 void QBoxSet::setBrush(const QBrush &brush)
242 248 {
243 249 if (d_ptr->m_brush != brush) {
244 250 d_ptr->m_brush = brush;
245 251 emit d_ptr->updatedBox();
246 252 emit brushChanged();
247 253 }
248 254 }
249 255
250 256 /*!
251 257 Returns brush of the set.
252 258 */
253 259 QBrush QBoxSet::brush() const
254 260 {
255 261 return d_ptr->m_brush;
256 262 }
257 263
258 264 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
259 265
260 266 QBoxSetPrivate::QBoxSetPrivate(const QString label, QBoxSet *parent) : QObject(parent),
261 267 q_ptr(parent),
262 268 m_label(label),
263 269 m_valuesCount(5),
264 270 m_appendCount(0),
265 271 m_pen(QPen(Qt::NoPen)),
266 272 m_brush(QBrush(Qt::NoBrush)),
267 273 m_series(0)
268 274 {
269 275 m_values = new qreal[m_valuesCount];
270 276 }
271 277
272 278 QBoxSetPrivate::~QBoxSetPrivate()
273 279 {
274 280 }
275 281
276 282 bool QBoxSetPrivate::append(qreal value)
277 283 {
278 284 if (isValidValue(value) && m_appendCount < m_valuesCount) {
279 285 m_values[m_appendCount++] = value;
280 286 emit restructuredBox();
281 287
282 288 return true;
283 289 }
284 290 return false;
285 291 }
286 292
287 293 bool QBoxSetPrivate::append(QList<qreal> values)
288 294 {
289 295 bool success = false;
290 296
291 297 for (int i = 0; i < values.count(); i++) {
292 298 if (isValidValue(values.at(i)) && m_appendCount < m_valuesCount) {
293 299 success = true;
294 300 m_values[m_appendCount++] = values.at(i);
295 301 }
296 302 }
297 303
298 304 if (success)
299 305 emit restructuredBox();
300 306
301 307 return success;
302 308 }
303 309
304 310 void QBoxSetPrivate::clear()
305 311 {
306 312 m_appendCount = 0;
307 313 for (int i = 0; i < m_valuesCount; i++)
308 314 m_values[i] = 0.0;
309 315 emit restructuredBox();
310 316 }
311 317
312 318 void QBoxSetPrivate::setValue(const int index, const qreal value)
313 319 {
314 320 if (index < m_valuesCount) {
315 321 m_values[index] = value;
316 322 emit updatedLayout();
317 323 }
318 324 }
319 325
320 326 qreal QBoxSetPrivate::value(const int index)
321 327 {
322 328 if (index < 0 || index >= m_valuesCount)
323 329 return 0;
324 330 return m_values[index];
325 331 }
326 332
327 333 #include "moc_qboxset.cpp"
328 334 #include "moc_qboxset_p.cpp"
329 335
330 336 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,784 +1,789
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qpieslice.h"
22 22 #include "qpieslice_p.h"
23 23
24 24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25 25
26 26 /*!
27 27 \class QPieSlice
28 28 \inmodule Qt Charts
29 29 \brief Defines a slice in pie series.
30 30
31 31 This object defines the properties of a single slice in a QPieSeries.
32 32
33 33 In addition to the obvious value and label properties the user can also control
34 34 the visual appearance of a slice. By modifying the visual appearance also means that
35 35 the user is overriding the default appearance set by the theme.
36 36
37 37 Note that if the user has customized slices and theme is changed all customizations will be lost.
38 38
39 39 To enable user interaction with the pie some basic signals are provided about clicking and hovering.
40 40 */
41 41
42 42 #ifdef QDOC_QT5
43 43 /*!
44 44 \qmltype PieSlice
45 45 \instantiates QPieSlice
46 46 \inqmlmodule QtCommercial.Chart
47 47
48 48 \include doc/src/pieslice.qdocinc
49 49 */
50 50 #else
51 51 /*!
52 52 \qmlclass PieSlice QPieSlice
53 53
54 54 \include ../doc/src/pieslice.qdocinc
55 55 */
56 56 #endif
57 57
58 58 /*!
59 59 \enum QPieSlice::LabelPosition
60 60
61 61 This enum describes the position of the slice label.
62 62
63 63 \value LabelOutside Label is outside the slice with an arm.
64 64 \value LabelInsideHorizontal Label is centered inside the slice and laid out horizontally.
65 65 \value LabelInsideTangential Label is centered inside the slice and rotated to be parallel to the tangential of the slice's arc.
66 66 \value LabelInsideNormal Label is centered inside the slice rotated to be parallel to the normal of the slice's arc.
67 67 */
68 68
69 69 /*!
70 70 \property QPieSlice::label
71 71 Label of the slice.
72 72 \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
73 73 */
74 74 /*!
75 75 \qmlproperty string PieSlice::label
76 76 Label (text) of the slice.
77 77 */
78 78
79 79 /*!
80 80 \fn void QPieSlice::labelChanged()
81 81 This signal emitted when the slice label has been changed.
82 82 \sa label
83 83 */
84 84 /*!
85 85 \qmlsignal PieSlice::onLabelChanged()
86 86 This signal emitted when the slice label has been changed.
87 87 \sa label
88 88 */
89 89
90 90 /*!
91 91 \property QPieSlice::value
92 92 Value of the slice.
93 93 Note that if users sets a negative value it is converted to a positive value.
94 94 \sa percentage(), QPieSeries::sum()
95 95 */
96 96 /*!
97 97 \qmlproperty real PieSlice::value
98 98 Value of the slice. Note that if users sets a negative value it is converted to a positive value.
99 99 */
100 100
101 101 /*!
102 102 \fn void QPieSlice::valueChanged()
103 103 This signal is emitted when the slice value changes.
104 104 \sa value
105 105 */
106 106 /*!
107 107 \qmlsignal PieSlice::onValueChanged()
108 108 This signal is emitted when the slice value changes.
109 109 \sa value
110 110 */
111 111
112 112 /*!
113 113 \property QPieSlice::labelVisible
114 114 Defines the visibility of slice label. By default the label is not visible.
115 115 \sa label, labelBrush, labelFont, labelArmLengthFactor
116 116 */
117 117 /*!
118 118 \qmlproperty bool PieSlice::labelVisible
119 119 Defines the visibility of slice label. By default the label is not visible.
120 120 */
121 121
122 122 /*!
123 123 \fn void QPieSlice::labelVisibleChanged()
124 124 This signal emitted when visibility of the slice label has changed.
125 125 \sa labelVisible
126 126 */
127 127 /*!
128 128 \qmlsignal PieSlice::onLabelVisibleChanged()
129 129 This signal emitted when visibility of the slice label has changed.
130 130 \sa labelVisible
131 131 */
132 132
133 133 /*!
134 134 \property QPieSlice::exploded
135 135 If set to true the slice is "exploded" away from the pie.
136 136 \sa explodeDistanceFactor
137 137 */
138 138 /*!
139 139 \qmlproperty bool PieSlice::exploded
140 140 If set to true the slice is "exploded" away from the pie.
141 141 \sa explodeDistanceFactor
142 142 */
143 143
144 144 /*!
145 145 \property QPieSlice::pen
146 146 Pen used to draw the slice border.
147 147 */
148 148
149 149 /*!
150 150 \fn void QPieSlice::penChanged()
151 151 This signal is emitted when the pen of the slice has changed.
152 152 \sa pen
153 153 */
154 154
155 155 /*!
156 156 \property QPieSlice::borderColor
157 157 Color used to draw the slice border.
158 158 This is a convenience property for modifying the slice pen.
159 159 \sa pen, borderWidth
160 160 */
161 161 /*!
162 162 \qmlproperty color PieSlice::borderColor
163 163 Color used to draw the slice border (pen color).
164 164 \sa borderWidth
165 165 */
166 166
167 167 /*!
168 168 \fn void QPieSlice::borderColorChanged()
169 169 This signal is emitted when slice border color changes.
170 170 \sa pen, borderColor
171 171 */
172 172 /*!
173 173 \qmlsignal PieSlice::onBorderColorChanged()
174 174 This signal is emitted when slice border color changes.
175 175 \sa borderColor
176 176 */
177 177
178 178 /*!
179 179 \property QPieSlice::borderWidth
180 180 Width of the slice border.
181 181 This is a convenience property for modifying the slice pen.
182 182 \sa pen, borderColor
183 183 */
184 184 /*!
185 185 \qmlproperty int PieSlice::borderWidth
186 186 Width of the slice border.
187 187 This is a convenience property for modifying the slice pen.
188 188 \sa borderColor
189 189 */
190 190
191 191 /*!
192 192 \fn void QPieSlice::borderWidthChanged()
193 193 This signal is emitted when slice border width changes.
194 194 \sa pen, borderWidth
195 195 */
196 196 /*!
197 197 \qmlsignal PieSlice::onBorderWidthChanged()
198 198 This signal is emitted when slice border width changes.
199 199 \sa borderWidth
200 200 */
201 201
202 202 /*!
203 203 \property QPieSlice::brush
204 204 Brush used to draw the slice.
205 205 */
206 206
207 207 /*!
208 208 \fn void QPieSlice::brushChanged()
209 209 This signal is emitted when the brush of the slice has changed.
210 210 \sa brush
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 219 \property QPieSlice::color
215 220 Fill (brush) color of the slice.
216 221 This is a convenience property for modifying the slice brush.
217 222 \sa brush
218 223 */
219 224 /*!
220 225 \qmlproperty color PieSlice::color
221 226 Fill (brush) color of the slice.
222 227 */
223 228
224 229 /*!
225 230 \fn void QPieSlice::colorChanged()
226 231 This signal is emitted when slice color changes.
227 232 \sa brush
228 233 */
229 234 /*!
230 235 \qmlsignal PieSlice::onColorChanged()
231 236 This signal is emitted when slice color changes.
232 237 */
233 238
234 239 /*!
235 240 \property QPieSlice::labelBrush
236 241 Brush used to draw label and label arm of the slice.
237 242 \sa label, labelVisible, labelFont, labelArmLengthFactor
238 243 */
239 244
240 245 /*!
241 246 \fn void QPieSlice::labelBrushChanged()
242 247 This signal is emitted when the label brush of the slice has changed.
243 248 \sa labelBrush
244 249 */
245 250
246 251 /*!
247 252 \property QPieSlice::labelColor
248 253 Color used to draw the slice label.
249 254 This is a convenience property for modifying the slice label brush.
250 255 \sa labelBrush
251 256 */
252 257 /*!
253 258 \qmlproperty color PieSlice::labelColor
254 259 Color used to draw the slice label.
255 260 */
256 261
257 262 /*!
258 263 \fn void QPieSlice::labelColorChanged()
259 264 This signal is emitted when slice label color changes.
260 265 \sa labelColor
261 266 */
262 267 /*!
263 268 \qmlsignal PieSlice::onLabelColorChanged()
264 269 This signal is emitted when slice label color changes.
265 270 \sa labelColor
266 271 */
267 272
268 273 /*!
269 274 \property QPieSlice::labelFont
270 275 Font used for drawing label text.
271 276 \sa label, labelVisible, labelArmLengthFactor
272 277 */
273 278
274 279 /*!
275 280 \fn void QPieSlice::labelFontChanged()
276 281 This signal is emitted when the label font of the slice has changed.
277 282 \sa labelFont
278 283 */
279 284
280 285 /*!
281 286 \qmlproperty Font PieSlice::labelFont
282 287
283 288 Defines the font used for slice label.
284 289
285 290 See the Qt documentation for more details of Font.
286 291
287 292 \sa labelVisible, labelPosition
288 293 */
289 294
290 295 /*!
291 296 \property QPieSlice::labelPosition
292 297 Position of the slice label.
293 298 \sa label, labelVisible
294 299 */
295 300 /*!
296 301 \qmlproperty LabelPosition PieSlice::labelPosition
297 302 Position of the slice label. One of PieSlice.LabelOutside, PieSlice.LabelInsideHorizontal,
298 303 PieSlice.LabelInsideTangential or PieSlice.LabelInsideNormal. By default the position is
299 304 PieSlice.LabelOutside.
300 305 \sa labelVisible
301 306 */
302 307
303 308 /*!
304 309 \property QPieSlice::labelArmLengthFactor
305 310 Defines the length of the label arm.
306 311 The factor is relative to pie radius. For example:
307 312 1.0 means the length is the same as the radius.
308 313 0.5 means the length is half of the radius.
309 314 By default the arm length is 0.15
310 315 \sa label, labelVisible, labelBrush, labelFont
311 316 */
312 317 /*!
313 318 \qmlproperty real PieSlice::labelArmLengthFactor
314 319 Defines the length of the label arm.
315 320 The factor is relative to pie radius. For example:
316 321 1.0 means the length is the same as the radius.
317 322 0.5 means the length is half of the radius.
318 323 By default the arm length is 0.15
319 324 \sa labelVisible
320 325 */
321 326
322 327 /*!
323 328 \property QPieSlice::explodeDistanceFactor
324 329 When the slice is exploded this factor defines how far the slice is exploded away from the pie.
325 330 The factor is relative to pie radius. For example:
326 331 1.0 means the distance is the same as the radius.
327 332 0.5 means the distance is half of the radius.
328 333 By default the distance is is 0.15
329 334 \sa exploded
330 335 */
331 336 /*!
332 337 \qmlproperty real PieSlice::explodeDistanceFactor
333 338 When the slice is exploded this factor defines how far the slice is exploded away from the pie.
334 339 The factor is relative to pie radius. For example:
335 340 1.0 means the distance is the same as the radius.
336 341 0.5 means the distance is half of the radius.
337 342 By default the distance is is 0.15
338 343 \sa exploded
339 344 */
340 345
341 346 /*!
342 347 \property QPieSlice::percentage
343 348 Percentage of the slice compared to the sum of all slices in the series.
344 349 The actual value ranges from 0.0 to 1.0.
345 350 Updated automatically once the slice is added to the series.
346 351 \sa value, QPieSeries::sum
347 352 */
348 353 /*!
349 354 \qmlproperty real PieSlice::percentage
350 355 Percentage of the slice compared to the sum of all slices in the series.
351 356 The actual value ranges from 0.0 to 1.0.
352 357 Updated automatically once the slice is added to the series.
353 358 */
354 359
355 360 /*!
356 361 \fn void QPieSlice::percentageChanged()
357 362 This signal is emitted when the percentage of the slice has changed.
358 363 \sa percentage
359 364 */
360 365 /*!
361 366 \qmlsignal void PieSlice::onPercentageChanged()
362 367 This signal is emitted when the percentage of the slice has changed.
363 368 \sa percentage
364 369 */
365 370
366 371 /*!
367 372 \property QPieSlice::startAngle
368 373 Defines the starting angle of this slice in the series it belongs to.
369 374 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
370 375 Updated automatically once the slice is added to the series.
371 376 */
372 377 /*!
373 378 \qmlproperty real PieSlice::startAngle
374 379 Defines the starting angle of this slice in the series it belongs to.
375 380 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
376 381 Updated automatically once the slice is added to the series.
377 382 */
378 383
379 384 /*!
380 385 \fn void QPieSlice::startAngleChanged()
381 386 This signal is emitted when the starting angle f the slice has changed.
382 387 \sa startAngle
383 388 */
384 389 /*!
385 390 \qmlsignal PieSlice::onStartAngleChanged()
386 391 This signal is emitted when the starting angle f the slice has changed.
387 392 \sa startAngle
388 393 */
389 394
390 395 /*!
391 396 \property QPieSlice::angleSpan
392 397 Span of the slice in degrees.
393 398 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
394 399 Updated automatically once the slice is added to the series.
395 400 */
396 401 /*!
397 402 \qmlproperty real PieSlice::angleSpan
398 403 Span of the slice in degrees.
399 404 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
400 405 Updated automatically once the slice is added to the series.
401 406 */
402 407
403 408 /*!
404 409 \fn void QPieSlice::angleSpanChanged()
405 410 This signal is emitted when the angle span of the slice has changed.
406 411 \sa angleSpan
407 412 */
408 413 /*!
409 414 \qmlsignal PieSlice::onAngleSpanChanged()
410 415 This signal is emitted when the angle span of the slice has changed.
411 416 \sa angleSpan
412 417 */
413 418
414 419 /*!
415 420 \fn void QPieSlice::clicked()
416 421 This signal is emitted when user has clicked the slice.
417 422 \sa QPieSeries::clicked()
418 423 */
419 424 /*!
420 425 \qmlsignal PieSlice::onClicked()
421 426 This signal is emitted when user has clicked the slice.
422 427 */
423 428
424 429 /*!
425 430 \fn void QPieSlice::hovered(bool state)
426 431 This signal is emitted when user has hovered over or away from the slice.
427 432 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
428 433 \sa QPieSeries::hovered()
429 434 */
430 435 /*!
431 436 \qmlsignal PieSlice::onHovered(bool state)
432 437 This signal is emitted when user has hovered over or away from the slice.
433 438 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
434 439 */
435 440
436 441 /*!
437 442 Constructs an empty slice with a \a parent.
438 443 \sa QPieSeries::append(), QPieSeries::insert()
439 444 */
440 445 QPieSlice::QPieSlice(QObject *parent)
441 446 : QObject(parent),
442 447 d_ptr(new QPieSlicePrivate(this))
443 448 {
444 449
445 450 }
446 451
447 452 /*!
448 453 Constructs an empty slice with given \a value, \a label and a \a parent.
449 454 \sa QPieSeries::append(), QPieSeries::insert()
450 455 */
451 456 QPieSlice::QPieSlice(QString label, qreal value, QObject *parent)
452 457 : QObject(parent),
453 458 d_ptr(new QPieSlicePrivate(this))
454 459 {
455 460 setValue(value);
456 461 setLabel(label);
457 462 }
458 463
459 464 /*!
460 465 Destroys the slice.
461 466 User should not delete the slice if it has been added to the series.
462 467 */
463 468 QPieSlice::~QPieSlice()
464 469 {
465 470
466 471 }
467 472
468 473 void QPieSlice::setLabel(QString label)
469 474 {
470 475 if (d_ptr->m_data.m_labelText != label) {
471 476 d_ptr->m_data.m_labelText = label;
472 477 emit labelChanged();
473 478 }
474 479 }
475 480
476 481 QString QPieSlice::label() const
477 482 {
478 483 return d_ptr->m_data.m_labelText;
479 484 }
480 485
481 486 void QPieSlice::setValue(qreal value)
482 487 {
483 488 value = qAbs(value); // negative values not allowed
484 489 if (!qFuzzyCompare(d_ptr->m_data.m_value, value)) {
485 490 d_ptr->m_data.m_value = value;
486 491 emit valueChanged();
487 492 }
488 493 }
489 494
490 495 qreal QPieSlice::value() const
491 496 {
492 497 return d_ptr->m_data.m_value;
493 498 }
494 499
495 500 void QPieSlice::setLabelVisible(bool visible)
496 501 {
497 502 if (d_ptr->m_data.m_isLabelVisible != visible) {
498 503 d_ptr->m_data.m_isLabelVisible = visible;
499 504 emit labelVisibleChanged();
500 505 }
501 506 }
502 507
503 508 bool QPieSlice::isLabelVisible() const
504 509 {
505 510 return d_ptr->m_data.m_isLabelVisible;
506 511 }
507 512
508 513 void QPieSlice::setExploded(bool exploded)
509 514 {
510 515 if (d_ptr->m_data.m_isExploded != exploded) {
511 516 d_ptr->m_data.m_isExploded = exploded;
512 517 emit d_ptr->explodedChanged();
513 518 }
514 519 }
515 520
516 521 QPieSlice::LabelPosition QPieSlice::labelPosition()
517 522 {
518 523 return d_ptr->m_data.m_labelPosition;
519 524 }
520 525
521 526 void QPieSlice::setLabelPosition(LabelPosition position)
522 527 {
523 528 if (d_ptr->m_data.m_labelPosition != position) {
524 529 d_ptr->m_data.m_labelPosition = position;
525 530 emit d_ptr->labelPositionChanged();
526 531 }
527 532 }
528 533
529 534 bool QPieSlice::isExploded() const
530 535 {
531 536 return d_ptr->m_data.m_isExploded;
532 537 }
533 538
534 539 void QPieSlice::setPen(const QPen &pen)
535 540 {
536 541 d_ptr->setPen(pen, false);
537 542 }
538 543
539 544 QPen QPieSlice::pen() const
540 545 {
541 546 return d_ptr->m_data.m_slicePen;
542 547 }
543 548
544 549 QColor QPieSlice::borderColor()
545 550 {
546 551 return pen().color();
547 552 }
548 553
549 554 void QPieSlice::setBorderColor(QColor color)
550 555 {
551 556 QPen p = pen();
552 557 if (color != p.color()) {
553 558 p.setColor(color);
554 559 setPen(p);
555 560 }
556 561 }
557 562
558 563 int QPieSlice::borderWidth()
559 564 {
560 565 return pen().width();
561 566 }
562 567
563 568 void QPieSlice::setBorderWidth(int width)
564 569 {
565 570 QPen p = pen();
566 571 if (width != p.width()) {
567 572 p.setWidth(width);
568 573 setPen(p);
569 574 }
570 575 }
571 576
572 577 void QPieSlice::setBrush(const QBrush &brush)
573 578 {
574 579 d_ptr->setBrush(brush, false);
575 580 }
576 581
577 582 QBrush QPieSlice::brush() const
578 583 {
579 584 return d_ptr->m_data.m_sliceBrush;
580 585 }
581 586
582 587 QColor QPieSlice::color()
583 588 {
584 589 return brush().color();
585 590 }
586 591
587 592 void QPieSlice::setColor(QColor color)
588 593 {
589 594 QBrush b = brush();
590 595
591 596 if (b == QBrush())
592 597 b.setStyle(Qt::SolidPattern);
593 598 b.setColor(color);
594 599 setBrush(b);
595 600 }
596 601
597 602 void QPieSlice::setLabelBrush(const QBrush &brush)
598 603 {
599 604 d_ptr->setLabelBrush(brush, false);
600 605 }
601 606
602 607 QBrush QPieSlice::labelBrush() const
603 608 {
604 609 return d_ptr->m_data.m_labelBrush;
605 610 }
606 611
607 612 QColor QPieSlice::labelColor()
608 613 {
609 614 return labelBrush().color();
610 615 }
611 616
612 617 void QPieSlice::setLabelColor(QColor color)
613 618 {
614 619 QBrush b = labelBrush();
615 620 if (color != b.color()) {
616 621 b.setColor(color);
617 622 setLabelBrush(b);
618 623 }
619 624 }
620 625
621 626 void QPieSlice::setLabelFont(const QFont &font)
622 627 {
623 628 d_ptr->setLabelFont(font, false);
624 629 }
625 630
626 631 QFont QPieSlice::labelFont() const
627 632 {
628 633 return d_ptr->m_data.m_labelFont;
629 634 }
630 635
631 636 void QPieSlice::setLabelArmLengthFactor(qreal factor)
632 637 {
633 638 if (!qFuzzyCompare(d_ptr->m_data.m_labelArmLengthFactor, factor)) {
634 639 d_ptr->m_data.m_labelArmLengthFactor = factor;
635 640 emit d_ptr->labelArmLengthFactorChanged();
636 641 }
637 642 }
638 643
639 644 qreal QPieSlice::labelArmLengthFactor() const
640 645 {
641 646 return d_ptr->m_data.m_labelArmLengthFactor;
642 647 }
643 648
644 649 void QPieSlice::setExplodeDistanceFactor(qreal factor)
645 650 {
646 651 if (!qFuzzyCompare(d_ptr->m_data.m_explodeDistanceFactor, factor)) {
647 652 d_ptr->m_data.m_explodeDistanceFactor = factor;
648 653 emit d_ptr->explodeDistanceFactorChanged();
649 654 }
650 655 }
651 656
652 657 qreal QPieSlice::explodeDistanceFactor() const
653 658 {
654 659 return d_ptr->m_data.m_explodeDistanceFactor;
655 660 }
656 661
657 662 qreal QPieSlice::percentage() const
658 663 {
659 664 return d_ptr->m_data.m_percentage;
660 665 }
661 666
662 667 qreal QPieSlice::startAngle() const
663 668 {
664 669 return d_ptr->m_data.m_startAngle;
665 670 }
666 671
667 672 qreal QPieSlice::angleSpan() const
668 673 {
669 674 return d_ptr->m_data.m_angleSpan;
670 675 }
671 676
672 677 /*!
673 678 Returns the series that this slice belongs to.
674 679
675 680 \sa QPieSeries::append()
676 681 */
677 682 QPieSeries *QPieSlice::series() const
678 683 {
679 684 return d_ptr->m_series;
680 685 }
681 686
682 687 QPieSlicePrivate::QPieSlicePrivate(QPieSlice *parent)
683 688 : QObject(parent),
684 689 q_ptr(parent),
685 690 m_series(0)
686 691 {
687 692
688 693 }
689 694
690 695 QPieSlicePrivate::~QPieSlicePrivate()
691 696 {
692 697
693 698 }
694 699
695 700 QPieSlicePrivate *QPieSlicePrivate::fromSlice(QPieSlice *slice)
696 701 {
697 702 return slice->d_func();
698 703 }
699 704
700 705 void QPieSlicePrivate::setPen(const QPen &pen, bool themed)
701 706 {
702 707 if (m_data.m_slicePen != pen) {
703 708
704 709 QPen oldPen = m_data.m_slicePen;
705 710
706 711 m_data.m_slicePen = pen;
707 712 m_data.m_slicePen.setThemed(themed);
708 713
709 714 emit q_ptr->penChanged();
710 715 if (oldPen.color() != pen.color())
711 716 emit q_ptr->borderColorChanged();
712 717 if (oldPen.width() != pen.width())
713 718 emit q_ptr->borderWidthChanged();
714 719 }
715 720 }
716 721
717 722 void QPieSlicePrivate::setBrush(const QBrush &brush, bool themed)
718 723 {
719 724 if (m_data.m_sliceBrush != brush) {
720 725
721 726 QBrush oldBrush = m_data.m_sliceBrush;
722 727
723 728 m_data.m_sliceBrush = brush;
724 729 m_data.m_sliceBrush.setThemed(themed);
725 730
726 731 emit q_ptr->brushChanged();
727 732 if (oldBrush.color() != brush.color())
728 733 emit q_ptr->colorChanged();
729 734 }
730 735 }
731 736
732 737 void QPieSlicePrivate::setLabelBrush(const QBrush &brush, bool themed)
733 738 {
734 739 if (m_data.m_labelBrush != brush) {
735 740
736 741 QBrush oldBrush = m_data.m_labelBrush;
737 742
738 743 m_data.m_labelBrush = brush;
739 744 m_data.m_labelBrush.setThemed(themed);
740 745
741 746 emit q_ptr->labelBrushChanged();
742 747 if (oldBrush.color() != brush.color())
743 748 emit q_ptr->labelColorChanged();
744 749 }
745 750 }
746 751
747 752 void QPieSlicePrivate::setLabelFont(const QFont &font, bool themed)
748 753 {
749 754 if (m_data.m_labelFont != font) {
750 755 m_data.m_labelFont = font;
751 756 m_data.m_labelFont.setThemed(themed);
752 757 emit q_ptr->labelFontChanged();
753 758 }
754 759 }
755 760
756 761 void QPieSlicePrivate::setPercentage(qreal percentage)
757 762 {
758 763 if (!qFuzzyCompare(m_data.m_percentage, percentage)) {
759 764 m_data.m_percentage = percentage;
760 765 emit q_ptr->percentageChanged();
761 766 }
762 767 }
763 768
764 769 void QPieSlicePrivate::setStartAngle(qreal angle)
765 770 {
766 771 if (!qFuzzyCompare(m_data.m_startAngle, angle)) {
767 772 m_data.m_startAngle = angle;
768 773 emit q_ptr->startAngleChanged();
769 774 }
770 775 }
771 776
772 777 void QPieSlicePrivate::setAngleSpan(qreal span)
773 778 {
774 779 if (!qFuzzyCompare(m_data.m_angleSpan, span)) {
775 780 m_data.m_angleSpan = span;
776 781 emit q_ptr->angleSpanChanged();
777 782 }
778 783 }
779 784
780 785 QTCOMMERCIALCHART_END_NAMESPACE
781 786
782 787 QTCOMMERCIALCHART_USE_NAMESPACE
783 788 #include "moc_qpieslice.cpp"
784 789 #include "moc_qpieslice_p.cpp"
@@ -1,310 +1,329
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qscatterseries.h"
22 22 #include "qscatterseries_p.h"
23 23 #include "scatterchartitem_p.h"
24 24 #include "chartdataset_p.h"
25 25 #include "charttheme_p.h"
26 26 #include "scatteranimation_p.h"
27 27 #include "qchart_p.h"
28 28
29 29 /*!
30 30 \class QScatterSeries
31 31 \inmodule Qt Charts
32 32 \brief The QScatterSeries class is used for making scatter charts.
33 33
34 34 \mainclass
35 35
36 36 The scatter data is displayed as a collection of points on the chart. Each point determines the position on the horizontal axis
37 37 and the vertical axis.
38 38
39 39 \image examples_scatterchart.png
40 40
41 41 Creating basic scatter chart is simple:
42 42 \code
43 43 QScatterSeries* series = new QScatterSeries();
44 44 series->append(0, 6);
45 45 series->append(2, 4);
46 46 ...
47 47 chart->addSeries(series);
48 48 \endcode
49 49 */
50 50 #ifdef QDOC_QT5
51 51 /*!
52 52 \qmltype ScatterSeries
53 53 \instantiates QScatterSeries
54 54 \inqmlmodule QtCommercial.Chart
55 55
56 56 \include doc/src/scatterseries.qdocinc
57 57 */
58 58 #else
59 59 /*!
60 60 \qmlclass ScatterSeries QScatterSeries
61 61
62 62 \include ../doc/src/scatterseries.qdocinc
63 63 */
64 64 #endif
65 65
66 66 /*!
67 67 \enum QScatterSeries::MarkerShape
68 68
69 69 This enum describes the shape used when rendering marker items.
70 70
71 71 \value MarkerShapeCircle
72 72 \value MarkerShapeRectangle
73 73 */
74 74
75 75 /*!
76 \property QScatterSeries::brush
77 Brush used to draw the series.
78 */
79
80 /*!
76 81 \property QScatterSeries::color
77 82 Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
78 83 \sa QScatterSeries::brush()
79 84 */
80 85
81 86 /*!
82 87 \property QScatterSeries::borderColor
83 88 Line (pen) color of the series. This is a convenience property for modifying the color of pen.
84 89 \sa QScatterSeries::pen()
85 90 */
86 91 /*!
87 92 \qmlproperty color ScatterSeries::borderColor
88 93 Border (pen) color of the series.
89 94 */
90 95
91 96 /*!
92 97 \qmlproperty real ScatterSeries::borderWidth
93 98 The width of the border line. By default the width is 2.0.
94 99 */
95 100
96 101 /*!
97 102 \property QScatterSeries::markerShape
98 103 Defines the shape of the marker used to draw the points in the series. The default shape is MarkerShapeCircle.
99 104 */
100 105 /*!
101 106 \qmlproperty MarkerShape ScatterSeries::markerShape
102 107 Defines the shape of the marker used to draw the points in the series. One of ScatterSeries
103 108 ScatterSeries.MarkerShapeCircle or ScatterSeries.MarkerShapeRectangle.
104 109 The default shape is ScatterSeries.MarkerShapeCircle.
105 110 */
106 111
107 112 /*!
108 113 \property QScatterSeries::markerSize
109 114 Defines the size of the marker used to draw the points in the series. The default size is 15.0.
110 115 */
111 116 /*!
112 117 \qmlproperty real ScatterSeries::markerSize
113 118 Defines the size of the marker used to draw the points in the series. The default size is 15.0.
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 127 \fn void QScatterSeries::colorChanged(QColor color)
118 128 Signal is emitted when the fill (brush) color has changed to \a color.
119 129 */
120 130
121 131 /*!
122 132 \fn void QScatterSeries::borderColorChanged(QColor color)
123 133 Signal is emitted when the line (pen) color has changed to \a color.
124 134 */
125 135 /*!
126 136 \qmlsignal ScatterSeries::borderColorChanged(color color)
127 137 Signal is emitted when the line (pen) color has changed to \a color.
128 138 */
129 139
130 140 /*!
131 141 \fn QAbstractSeries::SeriesType QScatterSeries::type() const
132 142 Returns QAbstractSeries::SeriesTypeScatter.
133 143 \sa QAbstractSeries, SeriesType
134 144 */
135 145
136 146 QTCOMMERCIALCHART_BEGIN_NAMESPACE
137 147
138 148 /*!
139 149 Constructs a series object which is a child of \a parent.
140 150 */
141 151 QScatterSeries::QScatterSeries(QObject *parent)
142 152 : QXYSeries(*new QScatterSeriesPrivate(this), parent)
143 153 {
144 154 }
145 155
146 156 /*!
147 157 Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
148 158 */
149 159 QScatterSeries::~QScatterSeries()
150 160 {
151 161 Q_D(QScatterSeries);
152 162 if (d->m_chart)
153 163 d->m_chart->removeSeries(this);
154 164 }
155 165
156 166 QAbstractSeries::SeriesType QScatterSeries::type() const
157 167 {
158 168 return QAbstractSeries::SeriesTypeScatter;
159 169 }
160 170
161 171 /*!
162 172 Sets \a pen used for drawing points' border on the chart. If the pen is not defined, the
163 173 pen from chart theme is used.
164 174 \sa QChart::setTheme()
165 175 */
166 176 void QScatterSeries::setPen(const QPen &pen)
167 177 {
168 178 Q_D(QXYSeries);
169 179 if (d->m_pen != pen) {
170 180 bool emitColorChanged = d->m_pen.color() != pen.color();
171 181 d->m_pen = pen;
172 182 emit d->updated();
173 183 if (emitColorChanged)
174 184 emit borderColorChanged(pen.color());
175 185 }
176 186 }
177 187
178 188 /*!
179 189 Sets \a brush used for drawing points on the chart. If the brush is not defined, brush
180 190 from chart theme setting is used.
181 191 \sa QChart::setTheme()
182 192 */
183 193 void QScatterSeries::setBrush(const QBrush &brush)
184 194 {
185 195 Q_D(QScatterSeries);
186 196 if (d->m_brush != brush) {
187 197 bool emitColorChanged = d->m_brush.color() != brush.color();
188 198 d->m_brush = brush;
189 199 emit d->updated();
190 200 if (emitColorChanged)
191 201 emit colorChanged(brush.color());
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 214 void QScatterSeries::setColor(const QColor &color)
196 215 {
197 216 QBrush b = brush();
198 217 if (b == QChartPrivate::defaultBrush())
199 218 b = QBrush();
200 219 if (b == QBrush())
201 220 b.setStyle(Qt::SolidPattern);
202 221 b.setColor(color);
203 222 setBrush(b);
204 223 }
205 224
206 225 QColor QScatterSeries::color() const
207 226 {
208 227 return brush().color();
209 228 }
210 229
211 230 void QScatterSeries::setBorderColor(const QColor &color)
212 231 {
213 232 QPen p = pen();
214 233 if (p == QChartPrivate::defaultPen())
215 234 p = QPen();
216 235 p.setColor(color);
217 236 setPen(p);
218 237 }
219 238
220 239 QColor QScatterSeries::borderColor() const
221 240 {
222 241 return pen().color();
223 242 }
224 243
225 244 QScatterSeries::MarkerShape QScatterSeries::markerShape() const
226 245 {
227 246 Q_D(const QScatterSeries);
228 247 return d->m_shape;
229 248 }
230 249
231 250 void QScatterSeries::setMarkerShape(MarkerShape shape)
232 251 {
233 252 Q_D(QScatterSeries);
234 253 if (d->m_shape != shape) {
235 254 d->m_shape = shape;
236 255 emit d->updated();
237 256 }
238 257 }
239 258
240 259 qreal QScatterSeries::markerSize() const
241 260 {
242 261 Q_D(const QScatterSeries);
243 262 return d->m_size;
244 263 }
245 264
246 265 void QScatterSeries::setMarkerSize(qreal size)
247 266 {
248 267 Q_D(QScatterSeries);
249 268
250 269 if (!qFuzzyCompare(d->m_size, size)) {
251 270 d->m_size = size;
252 271 emit d->updated();
253 272 }
254 273 }
255 274
256 275 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
257 276
258 277 QScatterSeriesPrivate::QScatterSeriesPrivate(QScatterSeries *q)
259 278 : QXYSeriesPrivate(q),
260 279 m_shape(QScatterSeries::MarkerShapeCircle),
261 280 m_size(15.0)
262 281 {
263 282 }
264 283
265 284 void QScatterSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
266 285 {
267 286 Q_Q(QScatterSeries);
268 287 ScatterChartItem *scatter = new ScatterChartItem(q,parent);
269 288 m_item.reset(scatter);
270 289 QAbstractSeriesPrivate::initializeGraphics(parent);
271 290 }
272 291
273 292 void QScatterSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
274 293 {
275 294 Q_Q(QScatterSeries);
276 295 const QList<QColor> colors = theme->seriesColors();
277 296 const QList<QGradient> gradients = theme->seriesGradients();
278 297
279 298 if (forced || QChartPrivate::defaultPen() == m_pen) {
280 299 QPen pen;
281 300 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
282 301 pen.setWidthF(2);
283 302 q->setPen(pen);
284 303 }
285 304
286 305 if (forced || QChartPrivate::defaultBrush() == m_brush) {
287 306 QBrush brush(colors.at(index % colors.size()));
288 307 q->setBrush(brush);
289 308 }
290 309 }
291 310
292 311 void QScatterSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
293 312 {
294 313 ScatterChartItem *item = static_cast<ScatterChartItem *>(m_item.data());
295 314 Q_ASSERT(item);
296 315
297 316 if (item->animation())
298 317 item->animation()->stopAndDestroyLater();
299 318
300 319 if (options.testFlag(QChart::SeriesAnimations))
301 320 item->setAnimation(new ScatterAnimation(item));
302 321 else
303 322 item->setAnimation(0);
304 323
305 324 QAbstractSeriesPrivate::initializeAnimations(options);
306 325 }
307 326
308 327 #include "moc_qscatterseries.cpp"
309 328
310 329 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,73 +1,75
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef QSCATTERSERIES_H
22 22 #define QSCATTERSERIES_H
23 23
24 24 #include <qchartglobal.h>
25 25 #include <qxyseries.h>
26 26
27 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28
29 29 class QScatterSeriesPrivate;
30 30
31 31 class QTCOMMERCIALCHART_EXPORT QScatterSeries : public QXYSeries
32 32 {
33 33 Q_OBJECT
34 34 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
35 35 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
36 36 Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape)
37 37 Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize)
38 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
38 39 Q_ENUMS(MarkerShape)
39 40
40 41 public:
41 42 enum MarkerShape {
42 43 MarkerShapeCircle,
43 44 MarkerShapeRectangle
44 45 };
45 46
46 47 public:
47 48 explicit QScatterSeries(QObject *parent = 0);
48 49 ~QScatterSeries();
49 50 QAbstractSeries::SeriesType type() const;
50 51 void setPen(const QPen &pen);
51 52 void setBrush(const QBrush &brush);
53 QBrush brush() const;
52 54 void setColor(const QColor &color);
53 55 QColor color() const;
54 56 void setBorderColor(const QColor &color);
55 57 QColor borderColor() const;
56 58 MarkerShape markerShape() const;
57 59 void setMarkerShape(MarkerShape shape);
58 60 qreal markerSize() const;
59 61 void setMarkerSize(qreal size);
60 62
61 63 Q_SIGNALS:
62 64 void colorChanged(QColor color);
63 65 void borderColorChanged(QColor color);
64 66
65 67 private:
66 68 Q_DECLARE_PRIVATE(QScatterSeries)
67 69 Q_DISABLE_COPY(QScatterSeries)
68 70 friend class ScatterChartItem;
69 71 };
70 72
71 73 QTCOMMERCIALCHART_END_NAMESPACE
72 74
73 75 #endif // QSCATTERSERIES_H
@@ -1,107 +1,107
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest BarCategoryAxis"
32 32 when: windowShown
33 33
34 34 function test_minMax() {
35 35 compare(barSeries1.axisX.min, "Jan", "AxisX min");
36 36 compare(barSeries1.axisX.max, "Jun", "AxisX max");
37 37 compare(barSeries1.axisY.min, 0, "AxisY min");
38 38 compare(barSeries1.axisY.max, 10, "AxisY max");
39 39 }
40 40
41 41 function test_categories() {
42 42 compare(barSeries1.axisX.count, 6, "AxisX count");
43 43 categoriesCountChangedSpy.clear();
44 44 categoriesChangedSpy.clear();
45 45
46 46 // Replace categories
47 47 barSeries1.axisX.categories = ["Tam", "Hel", "Maa", "Huh"];
48 48 compare(barSeries1.axisX.count, 4, "AxisX count");
49 49 compare(categoriesCountChangedSpy.count, 1, "onCountChanged");
50 50 compare(categoriesChangedSpy.count, 1, "onCategoriesChanged");
51 51
52 52 // Reset the original categories
53 53 barSeries1.axisX.categories = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
54 54 compare(barSeries1.axisX.count, 6, "AxisX count");
55 55 compare(categoriesCountChangedSpy.count, 2, "onCountChanged");
56 56 compare(categoriesChangedSpy.count, 2, "onCategoriesChanged");
57 57 }
58 58
59 59 function test_minMaxChanged() {
60 60 axisY.min = -1;
61 61 compare(minChangedSpy.count, 1, "onMinChanged");
62 62 compare(maxChangedSpy.count, 0, "onMaxChanged");
63 63 axisY.max = 12;
64 64 compare(minChangedSpy.count, 1, "onMinChanged");
65 65 compare(maxChangedSpy.count, 1, "onMaxChanged");
66 66 }
67 67 }
68 68
69 69 ChartView {
70 70 id: chartView
71 71 anchors.fill: parent
72 72
73 73 BarSeries {
74 74 id: barSeries1
75 75 axisX: BarCategoryAxis {
76 76 id: axisX
77 77 categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ]
78 78 }
79 79 axisY: ValuesAxis {
80 80 id: axisY
81 81 min: 0
82 82 max: 10
83 83 }
84 84 }
85 85
86 86 SignalSpy {
87 87 id: categoriesCountChangedSpy
88 88 target: axisX
89 89 signalName: "countChanged"
90 90 }
91 91 SignalSpy {
92 92 id: categoriesChangedSpy
93 93 target: axisX
94 94 signalName: "categoriesChanged"
95 95 }
96 96 SignalSpy {
97 97 id: minChangedSpy
98 98 target: axisY
99 99 signalName: "minChanged"
100 100 }
101 101 SignalSpy {
102 102 id: maxChangedSpy
103 103 target: axisY
104 104 signalName: "maxChanged"
105 105 }
106 106 }
107 107 }
@@ -1,146 +1,151
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest BarSeries"
32 32 when: windowShown
33 33
34 34 function test_properties() {
35 35 compare(barSeries.barWidth, 0.5);
36 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 44 function test_axes() {
40 45 verify(chartView.axisX() == barSeries.axisX);
41 46 verify(chartView.axisY() == barSeries.axisY);
42 47
43 48 compare(barSeries.axisX, stackedBarSeries.axisX);
44 49 compare(barSeries.axisY, stackedBarSeries.axisY);
45 50
46 51 compare(barSeries.axisX, percentBarSeries.axisX);
47 52 compare(barSeries.axisY, percentBarSeries.axisY);
48 53 }
49 54
50 55 function test_append() {
51 56 var setCount = 5;
52 57 var valueCount = 50;
53 58 addedSpy.clear();
54 59 append(setCount, valueCount);
55 60
56 61 compare(barSeries.count, setCount);
57 62 for (var k = 0; k < setCount; k++) {
58 63 compare(barSeries.at(k).count, valueCount);
59 64 compare(barSeries.at(k).label, "barset" + k);
60 65 }
61 66 compare(addedSpy.count, setCount);
62 67
63 68 barSeries.clear();
64 69 compare(barSeries.count, 0);
65 70 }
66 71
67 72 function test_insert() {
68 73 var setCount = 5;
69 74 var valueCount = 50;
70 75 addedSpy.clear();
71 76 append(setCount, valueCount);
72 77
73 78 for (var i = 0; i < setCount; i++) {
74 79 var values = [];
75 80 for (var j = 0; j < valueCount; j++)
76 81 values[j] = Math.random() * 10;
77 82 var set = barSeries.insert(i, "barset" + i, values);
78 83 compare(set.label, "barset" + i);
79 84 }
80 85
81 86 compare(barSeries.count, setCount * 2);
82 87 for (var k = 0; k < setCount * 2; k++)
83 88 compare(barSeries.at(k).count, valueCount);
84 89 compare(addedSpy.count, 2 * setCount);
85 90
86 91 barSeries.clear();
87 92 compare(barSeries.count, 0);
88 93 }
89 94
90 95 function test_remove() {
91 96 var setCount = 5;
92 97 var valueCount = 50;
93 98 removedSpy.clear();
94 99 append(setCount, valueCount);
95 100
96 101 for (var k = 0; k < setCount; k++)
97 102 barSeries.remove(barSeries.at(0));
98 103
99 104 compare(barSeries.count, 0);
100 105 compare(removedSpy.count, setCount);
101 106 }
102 107
103 108 // Not a test function, used by one or more test functions
104 109 function append(setCount, valueCount) {
105 110 for (var i = 0; i < setCount; i++) {
106 111 var values = [];
107 112 for (var j = 0; j < valueCount; j++)
108 113 values[j] = Math.random() * 10;
109 114 barSeries.append("barset" + i, values);
110 115 }
111 116 }
112 117 }
113 118
114 119 ChartView {
115 120 id: chartView
116 121 anchors.fill: parent
117 122
118 123 BarSeries {
119 124 id: barSeries
120 125 name: "bar"
121 126 axisX: BarCategoryAxis {}
122 127 axisY: ValueAxis { min: 0; max: 10 }
123 128
124 129 SignalSpy {
125 130 id: addedSpy
126 131 target: barSeries
127 132 signalName: "barsetsAdded"
128 133 }
129 134 SignalSpy {
130 135 id: removedSpy
131 136 target: barSeries
132 137 signalName: "barsetsRemoved"
133 138 }
134 139 }
135 140
136 141 StackedBarSeries {
137 142 id: stackedBarSeries
138 143 name: "stackedBar"
139 144 }
140 145
141 146 PercentBarSeries {
142 147 id: percentBarSeries
143 148 name: "percentBar"
144 149 }
145 150 }
146 151 }
@@ -1,96 +1,98
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest BoxPlotSeries"
32 32 when: windowShown
33 33
34 34 function test_properties() {
35 35 compare(boxPlotSeries.boxWidth, 0.5);
36 compare(boxPlotSeries.brushFilename, "");
36 37 }
37 38
38 39 function test_setproperties() {
39 40 var set = boxPlotSeries.append("boxplot", [1, 2, 5, 6, 8]);
40 41 compare(set.label, "boxplot");
41 42 compare(set.count, 5);
43 compare(set.brushFilename, "");
42 44 }
43 45
44 46 function test_append() {
45 47 addedSpy.clear();
46 48 countChangedSpy.clear();
47 49 var count = 50;
48 50 for (var i = 0; i < count; i++)
49 51 boxPlotSeries.append("boxplot" + i, Math.random());
50 52 compare(addedSpy.count, count);
51 53 compare(countChangedSpy.count, count);
52 54 console.log("Check the series count once QTRD-2504 is implemented");
53 55 boxPlotSeries.clear();
54 56 }
55 57
56 58 function test_remove() {
57 59 removedSpy.clear();
58 60 countChangedSpy.clear();
59 61 var count = 50;
60 62 for (var i = 0; i < count; i++)
61 63 boxPlotSeries.append("boxplot" + i, Math.random());
62 64 for (var j = 0; j < count; j++)
63 65 boxPlotSeries.remove(boxPlotSeries.at(0));
64 66 compare(removedSpy.count, count);
65 67 compare(countChangedSpy.count, 2 * count);
66 68 console.log("Check the series count once QTRD-2504 is implemented");
67 69 }
68 70 }
69 71
70 72 ChartView {
71 73 id: chartView
72 74 anchors.fill: parent
73 75
74 76 BoxPlotSeries {
75 77 id: boxPlotSeries
76 78 name: "boxplot"
77 79 BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
78 80
79 81 SignalSpy {
80 82 id: addedSpy
81 83 target: boxPlotSeries
82 84 signalName: "boxsetsAdded"
83 85 }
84 86 SignalSpy {
85 87 id: removedSpy
86 88 target: boxPlotSeries
87 89 signalName: "boxsetsRemoved"
88 90 }
89 91 SignalSpy {
90 92 id: countChangedSpy
91 93 target: boxPlotSeries
92 94 signalName: "countChanged"
93 95 }
94 96 }
95 97 }
96 98 }
@@ -1,84 +1,84
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest CategoryAxis"
32 32 when: windowShown
33 33
34 34 function test_minMax() {
35 35 compare(lineSeries1.axisX.min, 0, "AxisX min");
36 36 compare(lineSeries1.axisX.max, 10, "AxisX max");
37 37 compare(lineSeries1.axisY.min, 0, "AxisY min");
38 38 compare(lineSeries1.axisY.max, 10, "AxisY max");
39 39 }
40 40
41 41 function test_categories() {
42 42 compare(lineSeries1.axisY.startValue, 0, "AxisY start value");
43 43 compare(lineSeries1.axisY.count, 3, "AxisY count");
44 44 compare(lineSeries1.axisY.categoriesLabels[0], "label0", "AxisY categories labels");
45 45 compare(lineSeries1.axisY.categoriesLabels[1], "label1", "AxisY categories labels");
46 46 compare(lineSeries1.axisY.categoriesLabels[2], "label2", "AxisY categories labels");
47 47 }
48 48 }
49 49
50 50 ChartView {
51 51 id: chartView
52 52 anchors.fill: parent
53 53
54 54 LineSeries {
55 55 id: lineSeries1
56 56 axisX: ValuesAxis {
57 57 id: axisX
58 58 min: 0
59 59 max: 10
60 60 }
61 61 axisY: CategoryAxis {
62 62 id: axisY
63 63 min: 0
64 64 max: 10
65 65 startValue: 0
66 66 CategoryRange {
67 67 label: "label0"
68 68 endValue: 1
69 69 }
70 70 CategoryRange {
71 71 label: "label1"
72 72 endValue: 3
73 73 }
74 74 CategoryRange {
75 75 label: "label2"
76 76 endValue: 10
77 77 }
78 78 }
79 79 XYPoint { x: -1; y: -1 }
80 80 XYPoint { x: 0; y: 0 }
81 81 XYPoint { x: 5; y: 5 }
82 82 }
83 83 }
84 84 }
@@ -1,80 +1,80
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest ChartView Properties"
32 32 when: windowShown
33 33
34 34 function test_chartViewProperties() {
35 35 compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions");
36 36 verify(chartView.backgroundColor != undefined);
37 37 verify(chartView.margins.bottom > 0, "ChartView.margins.bottom");
38 38 verify(chartView.margins.top > 0, "ChartView.margins.top");
39 39 verify(chartView.margins.left > 0, "ChartView.margins.left");
40 40 verify(chartView.margins.right > 0, "ChartView.margins.right");
41 41 compare(chartView.count, 0, "ChartView.count");
42 42 compare(chartView.dropShadowEnabled, false, "ChartView.dropShadowEnabled");
43 43 verify(chartView.plotArea.height > 0, "ChartView.plotArea.height");
44 44 verify(chartView.plotArea.width > 0, "ChartView.plotArea.width");
45 45 verify(chartView.plotArea.x > 0, "ChartView.plotArea.x");
46 46 verify(chartView.plotArea.y > 0, "ChartView.plotArea.y");
47 47 compare(chartView.theme, ChartView.ChartThemeLight, "ChartView.theme");
48 48 compare(chartView.title, "", "ChartView.title");
49 49 compare(chartView.title, "", "ChartView.title");
50 50 verify(chartView.titleColor != undefined, "ChartView.titleColor");
51 51 compare(chartView.titleFont.bold, false, "ChartView.titleFont.bold");
52 52 // Legend
53 53 compare(chartView.legend.visible, true, "ChartView.legend.visible");
54 54 compare(chartView.legend.alignment, Qt.AlignTop, "ChartView.legend.alignment");
55 55 compare(chartView.legend.backgroundVisible, false, "ChartView.legend.backgroundVisible");
56 56 verify(chartView.legend.borderColor != undefined, "ChartView.legend.borderColor");
57 57 verify(chartView.legend.color != undefined, "ChartView.legend.color");
58 58 compare(chartView.legend.reverseMarkers, false, "ChartView.legend.reverseMarkers");
59 59 // Legend font
60 60 compare(chartView.legend.font.bold, false, "ChartView.legend.font.bold");
61 61 compare(chartView.legend.font.capitalization, Font.MixedCase, "ChartView.legend.font.capitalization");
62 62 verify(chartView.legend.font.family != "", "ChartView.legend.font.family");
63 63 compare(chartView.legend.font.italic, false, "ChartView.legend.font.italic");
64 64 compare(chartView.legend.font.letterSpacing, 0.0, "ChartView.legend.font.letterSpacing");
65 65 verify(chartView.legend.font.pixelSize > 0
66 66 && chartView.legend.font.pixelSize < 50, "ChartView.legend.font.pixelSize");
67 67 verify(chartView.legend.font.pointSize > 0
68 68 && chartView.legend.font.pointSize < 50, "ChartView.legend.font.pointSize");
69 69 compare(chartView.legend.font.strikeout, false, "ChartView.legend.font.strikeout");
70 70 compare(chartView.legend.font.underline, false, "ChartView.legend.font.underline");
71 71 compare(chartView.legend.font.weight, Font.Normal, "ChartView.legend.font.weight");
72 72 compare(chartView.legend.font.wordSpacing, 0.0, "ChartView.legend.font.wordSpacing");
73 73 }
74 74 }
75 75
76 76 ChartView {
77 77 id: chartView
78 78 anchors.fill: parent
79 79 }
80 80 }
@@ -1,160 +1,160
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest ChartView Functions"
32 32 when: windowShown
33 33
34 34 function test_chartViewSeriesAndAxes() {
35 35 // Create XY series
36 36 var line = chartView.createSeries(ChartView.SeriesTypeLine, "line");
37 37 verify(line != null && line != undefined);
38 38 var spline = chartView.createSeries(ChartView.SeriesTypeSpline, "spline");
39 39 verify(spline != null && spline != undefined);
40 40 var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter");
41 41 verify(scatter != null && scatter != undefined);
42 42
43 43 // Create a series with specific axes
44 44 var line2 = chartView.createSeries(ChartView.SeriesTypeLine, "line2", chartView.axisX(line), chartView.axisY(line));
45 45
46 46 // Check that all the XY series use the same axes
47 47 verify(chartView.axisX(line) != null);
48 48 verify(chartView.axisY(line) != null);
49 49 compare(chartView.axisX(line), chartView.axisX(line2));
50 50 compare(chartView.axisY(line), chartView.axisY(line2));
51 51 compare(chartView.axisX(line), chartView.axisX(spline));
52 52 compare(chartView.axisY(line), chartView.axisY(spline));
53 53 compare(chartView.axisX(line), chartView.axisX(scatter));
54 54 compare(chartView.axisY(line), chartView.axisY(scatter));
55 55
56 56 var bar = chartView.createSeries(ChartView.SeriesTypeBar, "bar");
57 57 verify(bar != null && bar != undefined);
58 58 var stackedbar = chartView.createSeries(ChartView.SeriesTypeStackedBar, "stackedbar");
59 59 verify(stackedbar != null && stackedbar != undefined);
60 60 var percentbar = chartView.createSeries(ChartView.SeriesTypePercentBar, "percentbar");
61 61 verify(percentbar != null && percentbar != undefined);
62 62 var horizontalbar = chartView.createSeries(ChartView.SeriesTypeHorizontalBar, "horizontalbar");
63 63 verify(horizontalbar != null && horizontalbar != undefined);
64 64 var horizontalstackedbar = chartView.createSeries(ChartView.SeriesTypeHorizontalStackedBar, "horizontalstackedbar");
65 65 verify(horizontalstackedbar != null && horizontalstackedbar != undefined);
66 66 var horizontalpercentbar = chartView.createSeries(ChartView.SeriesTypeHorizontalPercentBar, "horizontalpercentbar");
67 67 verify(horizontalpercentbar != null && horizontalpercentbar != undefined);
68 68 var area = chartView.createSeries(ChartView.SeriesTypeArea, "area");
69 69 verify(area != null && area != undefined);
70 70
71 71 // Remove all series
72 72 chartView.removeAllSeries();
73 73 compare(chartView.count, 0);
74 74 }
75 75
76 76 function test_chartViewRange() {
77 77 // Set initial values
78 78 chartView.createSeries(ChartView.SeriesTypeLine, "line");
79 79 verify(chartView.axisX() != null);
80 80 verify(chartView.axisY() != null);
81 81 chartView.axisX().min = 1.0;
82 82 chartView.axisX().max = 2.0;
83 83 chartView.axisY().min = 1.0;
84 84 chartView.axisY().max = 2.0;
85 85
86 86 var xMax = chartView.axisX().max;
87 87 var xMin = chartView.axisX().min;
88 88 var yMax = chartView.axisY().max;
89 89 var yMin = chartView.axisY().min;
90 90
91 91 // zoom x 2.5
92 92 chartView.zoom(1.5);
93 93 verify(chartView.axisX().max < xMax);
94 94 verify(chartView.axisX().min > xMin);
95 95 verify(chartView.axisY().max < yMax);
96 96 verify(chartView.axisY().min > yMin);
97 97 xMax = chartView.axisX().max;
98 98 xMin = chartView.axisX().min;
99 99 yMax = chartView.axisY().max;
100 100 yMin = chartView.axisY().min;
101 101
102 102 // zoom x 0.5
103 103 chartView.zoom(0.5);
104 104 verify(chartView.axisX().max > xMax);
105 105 verify(chartView.axisX().min < xMin);
106 106 verify(chartView.axisY().max > yMax);
107 107 verify(chartView.axisY().min < yMin);
108 108 xMax = chartView.axisX().max;
109 109 xMin = chartView.axisX().min;
110 110 yMax = chartView.axisY().max;
111 111 yMin = chartView.axisY().min;
112 112
113 113 // Scroll up
114 114 chartView.scrollUp(10);
115 115 compare(chartView.axisX().max, xMax);
116 116 compare(chartView.axisX().min, xMin);
117 117 verify(chartView.axisY().max > yMax);
118 118 verify(chartView.axisY().min > yMin);
119 119 xMax = chartView.axisX().max;
120 120 xMin = chartView.axisX().min;
121 121 yMax = chartView.axisY().max;
122 122 yMin = chartView.axisY().min;
123 123
124 124 // Scroll down
125 125 chartView.scrollDown(10);
126 126 compare(chartView.axisX().max, xMax);
127 127 compare(chartView.axisX().min, xMin);
128 128 verify(chartView.axisY().max < yMax);
129 129 verify(chartView.axisY().min < yMin);
130 130 xMax = chartView.axisX().max;
131 131 xMin = chartView.axisX().min;
132 132 yMax = chartView.axisY().max;
133 133 yMin = chartView.axisY().min;
134 134
135 135 // Scroll left
136 136 chartView.scrollLeft(10);
137 137 verify(chartView.axisX().max < xMax);
138 138 verify(chartView.axisX().min < xMin);
139 139 compare(chartView.axisY().max, yMax);
140 140 compare(chartView.axisY().min, yMin);
141 141 xMax = chartView.axisX().max;
142 142 xMin = chartView.axisX().min;
143 143 yMax = chartView.axisY().max;
144 144 yMin = chartView.axisY().min;
145 145
146 146 // Scroll right
147 147 chartView.scrollRight(10);
148 148 verify(chartView.axisX().max > xMax);
149 149 verify(chartView.axisX().min > xMin);
150 150 compare(chartView.axisY().max, yMax);
151 151 compare(chartView.axisY().min, yMin);
152 152 }
153 153 }
154 154
155 155 ChartView {
156 156 id: chartView
157 157 anchors.fill: parent
158 158 title: "Chart"
159 159 }
160 160 }
@@ -1,73 +1,73
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest ChartView Signals"
32 32 when: windowShown
33 33
34 34 // Verify onSeriesAdded and onSeriesRemoved signals
35 35 function test_chartView() {
36 36 var series = chartView.createSeries(ChartView.SeriesTypeLine, "line");
37 37 seriesAddedSpy.wait();
38 38 compare(seriesAddedSpy.count, 1, "ChartView.onSeriesAdded");
39 39
40 40 // Modifying layout triggers more than one plotAreaChanged signal
41 41 chartView.titleFont.pixelSize = 50;
42 42 verify(plotAreaChangedSpy.count > 0, "ChartView.onPlotAreaChanged");
43 43
44 44 chartView.removeSeries(series);
45 45 seriesRemovedSpy.wait();
46 46 compare(seriesRemovedSpy.count, 1, "ChartView.onSeriesAdded");
47 47 }
48 48 }
49 49
50 50 ChartView {
51 51 id: chartView
52 52 anchors.fill: parent
53 53 title: "Chart"
54 54
55 55 SignalSpy {
56 56 id: plotAreaChangedSpy
57 57 target: chartView
58 58 signalName: "plotAreaChanged"
59 59 }
60 60
61 61 SignalSpy {
62 62 id: seriesAddedSpy
63 63 target: chartView
64 64 signalName: "seriesAdded"
65 65 }
66 66
67 67 SignalSpy {
68 68 id: seriesRemovedSpy
69 69 target: chartView
70 70 signalName: "seriesRemoved"
71 71 }
72 72 }
73 73 }
@@ -1,131 +1,135
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest PieSeries"
32 32 when: windowShown
33 33
34 34 function test_properties() {
35 35 compare(pieSeries.endAngle, 360);
36 36 compare(pieSeries.holeSize, 0);
37 37 compare(pieSeries.horizontalPosition, 0.5);
38 38 compare(pieSeries.size, 0.7);
39 39 compare(pieSeries.startAngle, 0);
40 40 compare(pieSeries.sum, 0);
41 41 compare(pieSeries.verticalPosition, 0.5);
42 42 }
43 43
44 44 function test_sliceproperties() {
45 45 var slice = pieSeries.append("slice", 10);
46 46 compare(slice.angleSpan, 360.0);
47 47 verify(slice.borderColor != undefined);
48 48 compare(slice.borderWidth, 1);
49 49 verify(slice.color != undefined);
50 50 compare(slice.explodeDistanceFactor, 0.15);
51 51 compare(slice.exploded, false);
52 52 compare(slice.label, "slice");
53 53 compare(slice.labelArmLengthFactor, 0.15);
54 54 verify(slice.labelColor != undefined);
55 55 compare(slice.labelFont.bold, false);
56 56 compare(slice.labelPosition, PieSlice.LabelOutside);
57 57 compare(slice.labelVisible, false);
58 58 compare(slice.percentage, 1.0);
59 59 compare(slice.startAngle, 0.0);
60 60 compare(slice.value, 10.0);
61 compare(slice.brushFilename, "");
61 62 }
62 63
63 64 function test_append() {
64 65 addedSpy.clear();
65 66 countChangedSpy.clear();
66 67 sumChangedSpy.clear();
67 68 var count = 50;
68 69 for (var i = 0; i < count; i++)
69 70 pieSeries.append("slice" + i, Math.random());
70 71 compare(addedSpy.count, count);
71 72 compare(countChangedSpy.count, count);
72 73 compare(sumChangedSpy.count, count);
73 74 pieSeries.clear();
74 75 }
75 76
76 77 function test_remove() {
77 78 removedSpy.clear();
78 79 countChangedSpy.clear();
79 80 sumChangedSpy.clear();
80 81 var count = 50;
81 82 for (var i = 0; i < count; i++)
82 83 pieSeries.append("slice" + i, Math.random());
83 84 for (var j = 0; j < count; j++)
84 85 pieSeries.remove(pieSeries.at(0));
85 86 compare(removedSpy.count, count);
86 87 compare(countChangedSpy.count, 2 * count);
87 88 compare(sumChangedSpy.count, 2 * count);
88 89 compare(pieSeries.count, 0);
89 90 }
90 91
91 function test_find() {
92 function test_find_and_at() {
92 93 var count = 50;
93 94 for (var i = 0; i < count; i++)
94 95 pieSeries.append("slice" + i, Math.random());
95 for (var j = 0; j < count; j++)
96 for (var j = 0; j < count; j++) {
96 97 compare(pieSeries.find("slice" + j).label, "slice" + j);
98 compare(pieSeries.find("slice" + j).brushFilename, "");
99 }
100 compare(pieSeries.at(3).brushFilename,"");
97 101 pieSeries.clear();
98 102 }
99 103 }
100 104
101 105 ChartView {
102 106 id: chartView
103 107 anchors.fill: parent
104 108
105 109 PieSeries {
106 110 id: pieSeries
107 111 name: "pie"
108 112
109 113 SignalSpy {
110 114 id: addedSpy
111 115 target: pieSeries
112 116 signalName: "added"
113 117 }
114 118 SignalSpy {
115 119 id: removedSpy
116 120 target: pieSeries
117 121 signalName: "removed"
118 122 }
119 123 SignalSpy {
120 124 id: sumChangedSpy
121 125 target: pieSeries
122 126 signalName: "sumChanged"
123 127 }
124 128 SignalSpy {
125 129 id: countChangedSpy
126 130 target: pieSeries
127 131 signalName: "countChanged"
128 132 }
129 133 }
130 134 }
131 135 }
@@ -1,116 +1,116
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest ValueAxis"
32 32 when: windowShown
33 33
34 34 // test functions are run in alphabetical order, the name has 'a' so that it
35 35 // will be the first function to execute.
36 36 function test_a_properties() {
37 37 // Default properties
38 38 verify(axisX.min < 0, "AxisX min");
39 39 verify(axisX.max > 0, "AxisX max");
40 40 verify(axisY.min < 0, "AxisY min");
41 41 verify(axisY.max > 0, "AxisY max");
42 42 verify(axisX.tickCount == 5, "AxisX tick count");
43 43 verify(axisY.tickCount == 5, "AxisY tick count");
44 44 verify(axisX.labelFormat == "", "label format");
45 45
46 46 // Modify properties
47 47 axisX.tickCount = 3;
48 48 verify(axisX.tickCount == 3, "set tick count");
49 49 }
50 50
51 51 function test_functions() {
52 52 // Set the axis ranges to not "nice" ones...
53 53 var min = 0.032456456;
54 54 var max = 10.67845634;
55 55 axisX.min = min;
56 56 axisX.max = max;
57 57 axisY.min = min;
58 58 axisY.max = max;
59 59
60 60 // ...And then apply nice numbers and verify the range was changed
61 61 axisX.applyNiceNumbers();
62 62 axisY.applyNiceNumbers();
63 63 verify(axisX.min != min);
64 64 verify(axisX.max != max);
65 65 verify(axisY.min != min);
66 66 verify(axisY.max != max);
67 67 }
68 68
69 69 function test_signals() {
70 70 minChangedSpy.clear();
71 71 maxChangedSpy.clear();
72 72 axisX.min = 2;
73 73 compare(minChangedSpy.count, 1, "onMinChanged");
74 74 compare(maxChangedSpy.count, 0, "onMaxChanged");
75 75
76 76 axisX.max = 8;
77 77 compare(minChangedSpy.count, 1, "onMinChanged");
78 78 compare(maxChangedSpy.count, 1, "onMaxChanged");
79 79
80 80 // restore original values
81 81 axisX.min = 0;
82 82 axisX.max = 10;
83 83 compare(minChangedSpy.count, 2, "onMinChanged");
84 84 compare(maxChangedSpy.count, 2, "onMaxChanged");
85 85 }
86 86 }
87 87
88 88 ChartView {
89 89 id: chartView
90 90 anchors.fill: parent
91 91
92 92 LineSeries {
93 93 id: lineSeries1
94 94 axisX: ValueAxis {
95 95 id: axisX
96 96 }
97 97 axisY: ValueAxis {
98 98 id: axisY
99 99 }
100 100 XYPoint { x: -1; y: -1 }
101 101 XYPoint { x: 0; y: 0 }
102 102 XYPoint { x: 5; y: 5 }
103 103 }
104 104
105 105 SignalSpy {
106 106 id: minChangedSpy
107 107 target: axisX
108 108 signalName: "minChanged"
109 109 }
110 110 SignalSpy {
111 111 id: maxChangedSpy
112 112 target: axisX
113 113 signalName: "maxChanged"
114 114 }
115 115 }
116 116 }
@@ -1,260 +1,262
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2013 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Enterprise Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 11 ** accordance with the Qt Enterprise License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 2.0
22 22 import QtTest 1.0
23 import QtCommercial.Chart 1.3
23 import QtCommercial.Chart 1.4
24 24
25 25 Rectangle {
26 26 width: 400
27 27 height: 300
28 28
29 29 TestCase {
30 30 id: tc1
31 31 name: "tst_qml-qtquicktest XY Series"
32 32 when: windowShown
33 33
34 34 function test_properties() {
35 35 verify(lineSeries.color != undefined);
36 36 compare(lineSeries.pointsVisible, false);
37 37 compare(lineSeries.capStyle, Qt.SquareCap);
38 38 compare(lineSeries.style, Qt.SolidLine);
39 39 compare(lineSeries.width, 2.0);
40 40
41 41 verify(splineSeries.color != undefined);
42 42 compare(splineSeries.pointsVisible, false);
43 43 compare(splineSeries.capStyle, Qt.SquareCap);
44 44 compare(splineSeries.style, Qt.SolidLine);
45 45 compare(splineSeries.width, 2.0);
46 46
47 47 verify(scatterSeries.color != undefined);
48 48 verify(scatterSeries.borderColor != undefined);
49 49 compare(scatterSeries.borderWidth, 2.0);
50 50 compare(scatterSeries.markerShape, ScatterSeries.MarkerShapeCircle);
51 51 compare(scatterSeries.markerSize, 15.0);
52 compare(scatterSeries.brushFilename, "");
52 53
53 54 verify(areaSeries.color != undefined);
54 55 verify(areaSeries.borderColor != undefined);
55 56 compare(areaSeries.borderWidth, 2.0);
57 compare(areaSeries.brushFilename, "");
56 58 }
57 59
58 60 function test_axes() {
59 61 // Axis initialization
60 62 compare(chartView.axisX(), lineSeries.axisX);
61 63 compare(chartView.axisY(), lineSeries.axisY);
62 64 compare(lineSeries.axisX, splineSeries.axisX);
63 65 compare(lineSeries.axisY, splineSeries.axisY);
64 66 compare(lineSeries.axisX, areaSeries.axisX);
65 67 compare(lineSeries.axisY, areaSeries.axisY);
66 68 }
67 69
68 70 function test_append() {
69 71 lineSeriesPointAddedSpy.clear();
70 72 splineSeriesPointAddedSpy.clear();
71 73 scatterSeriesPointAddedSpy.clear();
72 74 var count = append();
73 75 compare(lineSeries.count, count);
74 76 compare(splineSeries.count, count);
75 77 compare(scatterSeries.count, count);
76 78 compare(lineSeriesPointAddedSpy.count, count);
77 79 compare(splineSeriesPointAddedSpy.count, count);
78 80 compare(scatterSeriesPointAddedSpy.count, count);
79 81 clear();
80 82 compare(lineSeries.count, 0);
81 83 compare(splineSeries.count, 0);
82 84 compare(scatterSeries.count, 0);
83 85 }
84 86
85 87 function test_replace() {
86 88 var count = append();
87 89 for (var i = 0; i < count; i++) {
88 90 lineSeries.replace(lineSeries.at(i).x, lineSeries.at(i).y, i, Math.random());
89 91 splineSeries.replace(splineSeries.at(i).x, splineSeries.at(i).y, i, Math.random());
90 92 scatterSeries.replace(scatterSeries.at(i).x, scatterSeries.at(i).y, i, Math.random());
91 93 }
92 94 compare(lineSeries.count, count);
93 95 compare(splineSeries.count, count);
94 96 compare(scatterSeries.count, count);
95 97 compare(lineSeriesPointReplacedSpy.count, count);
96 98 compare(splineSeriesPointReplacedSpy.count, count);
97 99 compare(scatterSeriesPointReplacedSpy.count, count);
98 100 clear();
99 101 }
100 102
101 103 function test_insert() {
102 104 var count = append();
103 105 lineSeriesPointAddedSpy.clear();
104 106 splineSeriesPointAddedSpy.clear();
105 107 scatterSeriesPointAddedSpy.clear();
106 108 for (var i = 0; i < count; i++) {
107 109 lineSeries.insert(i * 2, i, Math.random());
108 110 splineSeries.insert(i * 2, i, Math.random());
109 111 scatterSeries.insert(i * 2, i, Math.random());
110 112 }
111 113 compare(lineSeries.count, count * 2);
112 114 compare(splineSeries.count, count * 2);
113 115 compare(scatterSeries.count, count * 2);
114 116 compare(lineSeriesPointAddedSpy.count, count);
115 117 compare(splineSeriesPointAddedSpy.count, count);
116 118 compare(scatterSeriesPointAddedSpy.count, count);
117 119 clear();
118 120 }
119 121
120 122 function test_remove() {
121 123 lineSeriesPointRemovedSpy.clear();
122 124 splineSeriesPointRemovedSpy.clear();
123 125 scatterSeriesPointRemovedSpy.clear();
124 126 var count = append();
125 127 for (var i = 0; i < count; i++) {
126 128 lineSeries.remove(lineSeries.at(0).x, lineSeries.at(0).y);
127 129 splineSeries.remove(splineSeries.at(0).x, splineSeries.at(0).y);
128 130 scatterSeries.remove(scatterSeries.at(0).x, scatterSeries.at(0).y);
129 131 }
130 132 compare(lineSeries.count, 0);
131 133 compare(splineSeries.count, 0);
132 134 compare(scatterSeries.count, 0);
133 135 compare(lineSeriesPointRemovedSpy.count, count);
134 136 compare(splineSeriesPointRemovedSpy.count, count);
135 137 compare(scatterSeriesPointRemovedSpy.count, count);
136 138 }
137 139
138 140 // Not a test function, called from test functions
139 141 function append() {
140 142 var count = 100;
141 143 chartView.axisX().min = 0;
142 144 chartView.axisX().max = 100;
143 145 chartView.axisY().min = 0;
144 146 chartView.axisY().max = 1;
145 147
146 148 for (var i = 0; i < count; i++) {
147 149 lineSeries.append(i, Math.random());
148 150 splineSeries.append(i, Math.random());
149 151 scatterSeries.append(i, Math.random());
150 152 }
151 153
152 154 return count;
153 155 }
154 156
155 157 // Not a test function, called from test functions
156 158 function clear() {
157 159 lineSeries.clear();
158 160 splineSeries.clear();
159 161 scatterSeries.clear();
160 162 }
161 163 }
162 164
163 165 ChartView {
164 166 id: chartView
165 167 anchors.fill: parent
166 168
167 169 LineSeries {
168 170 id: lineSeries
169 171 name: "line"
170 172
171 173 SignalSpy {
172 174 id: lineSeriesPointAddedSpy
173 175 target: lineSeries
174 176 signalName: "pointAdded"
175 177 }
176 178
177 179 SignalSpy {
178 180 id: lineSeriesPointReplacedSpy
179 181 target: lineSeries
180 182 signalName: "pointReplaced"
181 183 }
182 184
183 185 SignalSpy {
184 186 id: lineSeriesPointsReplacedSpy
185 187 target: lineSeries
186 188 signalName: "pointsReplaced"
187 189 }
188 190
189 191 SignalSpy {
190 192 id: lineSeriesPointRemovedSpy
191 193 target: lineSeries
192 194 signalName: "pointRemoved"
193 195 }
194 196 }
195 197
196 198 AreaSeries {
197 199 id: areaSeries
198 200 name: "area"
199 201 upperSeries: lineSeries
200 202 }
201 203
202 204 SplineSeries {
203 205 id: splineSeries
204 206 name: "spline"
205 207
206 208 SignalSpy {
207 209 id: splineSeriesPointAddedSpy
208 210 target: splineSeries
209 211 signalName: "pointAdded"
210 212 }
211 213
212 214 SignalSpy {
213 215 id: splineSeriesPointReplacedSpy
214 216 target: splineSeries
215 217 signalName: "pointReplaced"
216 218 }
217 219
218 220 SignalSpy {
219 221 id: splineSeriesPointsReplacedSpy
220 222 target: splineSeries
221 223 signalName: "pointsReplaced"
222 224 }
223 225
224 226 SignalSpy {
225 227 id: splineSeriesPointRemovedSpy
226 228 target: splineSeries
227 229 signalName: "pointRemoved"
228 230 }
229 231 }
230 232
231 233 ScatterSeries {
232 234 id: scatterSeries
233 235 name: "scatter"
234 236
235 237 SignalSpy {
236 238 id: scatterSeriesPointAddedSpy
237 239 target: scatterSeries
238 240 signalName: "pointAdded"
239 241 }
240 242
241 243 SignalSpy {
242 244 id: scatterSeriesPointReplacedSpy
243 245 target: scatterSeries
244 246 signalName: "pointReplaced"
245 247 }
246 248
247 249 SignalSpy {
248 250 id: scatterSeriesPointsReplacedSpy
249 251 target: scatterSeries
250 252 signalName: "pointsReplaced"
251 253 }
252 254
253 255 SignalSpy {
254 256 id: scatterSeriesPointRemovedSpy
255 257 target: scatterSeries
256 258 signalName: "pointRemoved"
257 259 }
258 260 }
259 261 }
260 262 }
General Comments 0
You need to be logged in to leave comments. Login now