@@ -1,52 +1,47 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | anchors.fill: parent |
|
25 | anchors.fill: parent | |
26 |
|
26 | |||
27 | Chart { |
|
27 | Chart { | |
28 | title: "Car brand shares in Finland" |
|
28 | title: "Car brand shares in Finland" | |
29 | anchors.fill: parent |
|
29 | anchors.fill: parent | |
30 | theme: Chart.ChartThemeLight |
|
30 | theme: Chart.ChartThemeLight | |
31 | legend: Chart.LegendBottom |
|
31 | legend: Chart.LegendBottom | |
32 |
|
32 | |||
33 | PieSeries { |
|
33 | PieSeries { | |
34 |
horizontalPosition: 0. |
|
34 | horizontalPosition: 0.5 | |
35 |
verticalPosition: 0. |
|
35 | verticalPosition: 0.5 | |
36 |
size: 0. |
|
36 | size: 0.7 | |
37 | slices: [ |
|
37 | slices: [ | |
38 | PieSlice { label: "Volkswagen"; value: 13.5 }, |
|
38 | PieSlice { label: "Volkswagen"; value: 13.5 }, | |
39 | PieSlice { label: "Toyota"; value: 10.9 }, |
|
39 | PieSlice { label: "Toyota"; value: 10.9 }, | |
40 | PieSlice { label: "Ford"; value: 8.6 }, |
|
40 | PieSlice { label: "Ford"; value: 8.6 }, | |
41 | PieSlice { label: "Skoda"; value: 8.2 }, |
|
41 | PieSlice { label: "Skoda"; value: 8.2 }, | |
42 | PieSlice { label: "Volvo"; value: 6.8 }, |
|
42 | PieSlice { label: "Volvo"; value: 6.8 }, | |
43 | PieSlice { label: "Others"; value: 52.0 } |
|
43 | PieSlice { label: "Others"; value: 52.0 } | |
44 | ] |
|
44 | ] | |
45 | } |
|
45 | } | |
46 |
|
||||
47 | BarSeries { |
|
|||
48 | barCategories: [ "2008", "2009", "2010", "2011", "2012" ] |
|
|||
49 | // data implementation missing |
|
|||
50 | } |
|
|||
51 | } |
|
46 | } | |
52 | } |
|
47 | } |
@@ -1,129 +1,129 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | anchors.fill: parent |
|
25 | anchors.fill: parent | |
26 |
|
26 | |||
27 | Chart { |
|
27 | Chart { | |
28 | title: "NHL All-Star Team Players" |
|
28 | title: "NHL All-Star Team Players" | |
29 | anchors.fill: parent |
|
29 | anchors.fill: parent | |
30 | theme: Chart.ChartThemeHighContrast |
|
30 | theme: Chart.ChartThemeHighContrast | |
31 | legend: Chart.LegendTop |
|
31 | legend: Chart.LegendTop | |
32 |
|
32 | |||
33 | AreaSeries { |
|
33 | AreaSeries { | |
34 |
name: " |
|
34 | name: "Swedish" | |
35 | points: [ |
|
35 | points: [ | |
36 |
XyPoint { x: 0; y: |
|
36 | XyPoint { x: 0; y: 1 }, | |
37 |
XyPoint { x: 1; y: |
|
37 | XyPoint { x: 1; y: 1 }, | |
38 |
XyPoint { x: 2; y: |
|
38 | XyPoint { x: 2; y: 3 }, | |
39 |
XyPoint { x: 3; y: |
|
39 | XyPoint { x: 3; y: 3 }, | |
40 |
XyPoint { x: 4; y: |
|
40 | XyPoint { x: 4; y: 2 }, | |
41 | XyPoint { x: 5; y: 0 }, |
|
41 | XyPoint { x: 5; y: 0 }, | |
42 |
XyPoint { x: 6; y: |
|
42 | XyPoint { x: 6; y: 2 }, | |
43 |
XyPoint { x: 7; y: |
|
43 | XyPoint { x: 7; y: 1 }, | |
44 |
XyPoint { x: 8; y: |
|
44 | XyPoint { x: 8; y: 2 }, | |
45 |
XyPoint { x: 9; y: |
|
45 | XyPoint { x: 9; y: 1 }, | |
46 |
XyPoint { x: 10; y: |
|
46 | XyPoint { x: 10; y: 3 }, | |
47 |
XyPoint { x: 11; y: |
|
47 | XyPoint { x: 11; y: 3 } | |
48 | ] |
|
48 | ] | |
49 | lowerPoints: [ |
|
49 | lowerPoints: [ | |
50 | XyPoint { x: 0; y: 0 }, |
|
50 | XyPoint { x: 0; y: 0 }, | |
51 | XyPoint { x: 1; y: 0 }, |
|
51 | XyPoint { x: 1; y: 0 }, | |
52 | XyPoint { x: 2; y: 0 }, |
|
52 | XyPoint { x: 2; y: 0 }, | |
53 | XyPoint { x: 3; y: 0 }, |
|
53 | XyPoint { x: 3; y: 0 }, | |
54 | XyPoint { x: 4; y: 0 }, |
|
54 | XyPoint { x: 4; y: 0 }, | |
55 | XyPoint { x: 5; y: 0 }, |
|
55 | XyPoint { x: 5; y: 0 }, | |
56 | XyPoint { x: 6; y: 0 }, |
|
56 | XyPoint { x: 6; y: 0 }, | |
57 | XyPoint { x: 7; y: 0 }, |
|
57 | XyPoint { x: 7; y: 0 }, | |
58 | XyPoint { x: 8; y: 0 }, |
|
58 | XyPoint { x: 8; y: 0 }, | |
59 | XyPoint { x: 9; y: 0 }, |
|
59 | XyPoint { x: 9; y: 0 }, | |
60 | XyPoint { x: 10; y: 0 }, |
|
60 | XyPoint { x: 10; y: 0 }, | |
61 | XyPoint { x: 11; y: 0 } |
|
61 | XyPoint { x: 11; y: 0 } | |
62 | ] |
|
62 | ] | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | AreaSeries { |
|
65 | AreaSeries { | |
66 | name: "Russian" |
|
66 | name: "Russian" | |
67 | points: [ |
|
67 | points: [ | |
68 | XyPoint { x: 0; y: 1 }, |
|
68 | XyPoint { x: 0; y: 1 }, | |
69 | XyPoint { x: 1; y: 1 }, |
|
69 | XyPoint { x: 1; y: 1 }, | |
70 | XyPoint { x: 2; y: 1 }, |
|
70 | XyPoint { x: 2; y: 1 }, | |
71 | XyPoint { x: 3; y: 1 }, |
|
71 | XyPoint { x: 3; y: 1 }, | |
72 | XyPoint { x: 4; y: 1 }, |
|
72 | XyPoint { x: 4; y: 1 }, | |
73 | XyPoint { x: 5; y: 0 }, |
|
73 | XyPoint { x: 5; y: 0 }, | |
74 | XyPoint { x: 6; y: 1 }, |
|
74 | XyPoint { x: 6; y: 1 }, | |
75 | XyPoint { x: 7; y: 1 }, |
|
75 | XyPoint { x: 7; y: 1 }, | |
76 | XyPoint { x: 8; y: 4 }, |
|
76 | XyPoint { x: 8; y: 4 }, | |
77 | XyPoint { x: 9; y: 3 }, |
|
77 | XyPoint { x: 9; y: 3 }, | |
78 | XyPoint { x: 10; y: 2 }, |
|
78 | XyPoint { x: 10; y: 2 }, | |
79 | XyPoint { x: 11; y: 1 } |
|
79 | XyPoint { x: 11; y: 1 } | |
80 | ] |
|
80 | ] | |
81 | lowerPoints: [ |
|
81 | lowerPoints: [ | |
82 | XyPoint { x: 0; y: 0 }, |
|
82 | XyPoint { x: 0; y: 0 }, | |
83 | XyPoint { x: 1; y: 0 }, |
|
83 | XyPoint { x: 1; y: 0 }, | |
84 | XyPoint { x: 2; y: 0 }, |
|
84 | XyPoint { x: 2; y: 0 }, | |
85 | XyPoint { x: 3; y: 0 }, |
|
85 | XyPoint { x: 3; y: 0 }, | |
86 | XyPoint { x: 4; y: 0 }, |
|
86 | XyPoint { x: 4; y: 0 }, | |
87 | XyPoint { x: 5; y: 0 }, |
|
87 | XyPoint { x: 5; y: 0 }, | |
88 | XyPoint { x: 6; y: 0 }, |
|
88 | XyPoint { x: 6; y: 0 }, | |
89 | XyPoint { x: 7; y: 0 }, |
|
89 | XyPoint { x: 7; y: 0 }, | |
90 | XyPoint { x: 8; y: 0 }, |
|
90 | XyPoint { x: 8; y: 0 }, | |
91 | XyPoint { x: 9; y: 0 }, |
|
91 | XyPoint { x: 9; y: 0 }, | |
92 | XyPoint { x: 10; y: 0 }, |
|
92 | XyPoint { x: 10; y: 0 }, | |
93 | XyPoint { x: 11; y: 0 } |
|
93 | XyPoint { x: 11; y: 0 } | |
94 | ] |
|
94 | ] | |
95 | } |
|
95 | } | |
96 |
|
96 | |||
97 | AreaSeries { |
|
97 | AreaSeries { | |
98 |
name: " |
|
98 | name: "Finnish" | |
99 | points: [ |
|
99 | points: [ | |
100 |
XyPoint { x: 0; y: |
|
100 | XyPoint { x: 0; y: 0 }, | |
101 |
XyPoint { x: 1; y: |
|
101 | XyPoint { x: 1; y: 0 }, | |
102 |
XyPoint { x: 2; y: |
|
102 | XyPoint { x: 2; y: 0 }, | |
103 |
XyPoint { x: 3; y: |
|
103 | XyPoint { x: 3; y: 0 }, | |
104 |
XyPoint { x: 4; y: |
|
104 | XyPoint { x: 4; y: 0 }, | |
105 | XyPoint { x: 5; y: 0 }, |
|
105 | XyPoint { x: 5; y: 0 }, | |
106 |
XyPoint { x: 6; y: |
|
106 | XyPoint { x: 6; y: 1 }, | |
107 |
XyPoint { x: 7; y: |
|
107 | XyPoint { x: 7; y: 0 }, | |
108 |
XyPoint { x: 8; y: |
|
108 | XyPoint { x: 8; y: 0 }, | |
109 |
XyPoint { x: 9; y: |
|
109 | XyPoint { x: 9; y: 0 }, | |
110 |
XyPoint { x: 10; y: |
|
110 | XyPoint { x: 10; y: 0 }, | |
111 |
XyPoint { x: 11; y: |
|
111 | XyPoint { x: 11; y: 1 } | |
112 | ] |
|
112 | ] | |
113 | lowerPoints: [ |
|
113 | lowerPoints: [ | |
114 | XyPoint { x: 0; y: 0 }, |
|
114 | XyPoint { x: 0; y: 0 }, | |
115 | XyPoint { x: 1; y: 0 }, |
|
115 | XyPoint { x: 1; y: 0 }, | |
116 | XyPoint { x: 2; y: 0 }, |
|
116 | XyPoint { x: 2; y: 0 }, | |
117 | XyPoint { x: 3; y: 0 }, |
|
117 | XyPoint { x: 3; y: 0 }, | |
118 | XyPoint { x: 4; y: 0 }, |
|
118 | XyPoint { x: 4; y: 0 }, | |
119 | XyPoint { x: 5; y: 0 }, |
|
119 | XyPoint { x: 5; y: 0 }, | |
120 | XyPoint { x: 6; y: 0 }, |
|
120 | XyPoint { x: 6; y: 0 }, | |
121 | XyPoint { x: 7; y: 0 }, |
|
121 | XyPoint { x: 7; y: 0 }, | |
122 | XyPoint { x: 8; y: 0 }, |
|
122 | XyPoint { x: 8; y: 0 }, | |
123 | XyPoint { x: 9; y: 0 }, |
|
123 | XyPoint { x: 9; y: 0 }, | |
124 | XyPoint { x: 10; y: 0 }, |
|
124 | XyPoint { x: 10; y: 0 }, | |
125 | XyPoint { x: 11; y: 0 } |
|
125 | XyPoint { x: 11; y: 0 } | |
126 | ] |
|
126 | ] | |
127 | } |
|
127 | } | |
128 | } |
|
128 | } | |
129 | } |
|
129 | } |
@@ -1,53 +1,53 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | width: parent.width |
|
25 | width: parent.width | |
26 | height: parent.height |
|
26 | height: parent.height | |
27 | property int __viewNumber: 0 |
|
27 | property int __viewNumber: 0 | |
28 |
|
28 | |||
29 | Timer { |
|
29 | Timer { | |
30 | id: timer |
|
30 | id: timer | |
31 | running: true |
|
31 | running: true | |
32 | repeat: true |
|
32 | repeat: true | |
33 | interval: 5000 |
|
33 | interval: 5000 | |
34 | triggeredOnStart: false |
|
34 | triggeredOnStart: false | |
35 | onTriggered: { |
|
35 | onTriggered: { | |
36 | __viewNumber++; |
|
36 | __viewNumber++; | |
37 | } |
|
37 | } | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | Loader { |
|
40 | Loader { | |
41 | id: loader |
|
41 | id: loader | |
42 | anchors.fill: parent |
|
42 | anchors.fill: parent | |
43 |
source: "View" + (__viewNumber % |
|
43 | source: "View" + (__viewNumber % 5 + 1) + ".qml"; | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | MouseArea { |
|
46 | MouseArea { | |
47 | anchors.fill: parent |
|
47 | anchors.fill: parent | |
48 | onClicked: { |
|
48 | onClicked: { | |
49 | timer.restart(); |
|
49 | timer.restart(); | |
50 | __viewNumber++; |
|
50 | __viewNumber++; | |
51 | } |
|
51 | } | |
52 | } |
|
52 | } | |
53 | } |
|
53 | } |
@@ -1,10 +1,11 | |||||
1 | <RCC> |
|
1 | <RCC> | |
2 | <qresource prefix="/"> |
|
2 | <qresource prefix="/"> | |
3 | <file>qml/qmlchart/loader.qml</file> |
|
3 | <file>qml/qmlchart/loader.qml</file> | |
4 | <file>qml/qmlchart/main.qml</file> |
|
4 | <file>qml/qmlchart/main.qml</file> | |
5 | <file>qml/qmlchart/View1.qml</file> |
|
5 | <file>qml/qmlchart/View1.qml</file> | |
6 | <file>qml/qmlchart/View2.qml</file> |
|
6 | <file>qml/qmlchart/View2.qml</file> | |
7 | <file>qml/qmlchart/View3.qml</file> |
|
7 | <file>qml/qmlchart/View3.qml</file> | |
8 | <file>qml/qmlchart/View4.qml</file> |
|
8 | <file>qml/qmlchart/View4.qml</file> | |
|
9 | <file>qml/qmlchart/View5.qml</file> | |||
9 | </qresource> |
|
10 | </qresource> | |
10 | </RCC> |
|
11 | </RCC> |
@@ -1,70 +1,65 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativeareaseries.h" |
|
21 | #include "declarativeareaseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qlineseries.h" |
|
24 | #include "qlineseries.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) : |
|
28 | DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) : | |
29 | QAreaSeries(new QLineSeries(parent), new QLineSeries(parent)) |
|
29 | QAreaSeries(new QLineSeries(parent), new QLineSeries(parent)) | |
30 | { |
|
30 | { | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | QAbstractSeries *DeclarativeAreaSeries::series() |
|
|||
34 | { |
|
|||
35 | return this; |
|
|||
36 | } |
|
|||
37 |
|
||||
38 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeAreaSeries::points() |
|
33 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeAreaSeries::points() | |
39 | { |
|
34 | { | |
40 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeAreaSeries::appendPoints); |
|
35 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeAreaSeries::appendPoints); | |
41 | } |
|
36 | } | |
42 |
|
37 | |||
43 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeAreaSeries::lowerPoints() |
|
38 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeAreaSeries::lowerPoints() | |
44 | { |
|
39 | { | |
45 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeAreaSeries::appendLowerPoints); |
|
40 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeAreaSeries::appendLowerPoints); | |
46 | } |
|
41 | } | |
47 |
|
42 | |||
48 | void DeclarativeAreaSeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, |
|
43 | void DeclarativeAreaSeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
49 | DeclarativeXyPoint *element) |
|
44 | DeclarativeXyPoint *element) | |
50 | { |
|
45 | { | |
51 | QAreaSeries *series = qobject_cast<QAreaSeries *>(list->object); |
|
46 | QAreaSeries *series = qobject_cast<QAreaSeries *>(list->object); | |
52 | if (series) { |
|
47 | if (series) { | |
53 | QLineSeries *upper = series->upperSeries(); |
|
48 | QLineSeries *upper = series->upperSeries(); | |
54 | upper->append(element->x(), element->y()); |
|
49 | upper->append(element->x(), element->y()); | |
55 | } |
|
50 | } | |
56 | } |
|
51 | } | |
57 |
|
52 | |||
58 | void DeclarativeAreaSeries::appendLowerPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, |
|
53 | void DeclarativeAreaSeries::appendLowerPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
59 | DeclarativeXyPoint *element) |
|
54 | DeclarativeXyPoint *element) | |
60 | { |
|
55 | { | |
61 | QAreaSeries *series = qobject_cast<QAreaSeries *>(list->object); |
|
56 | QAreaSeries *series = qobject_cast<QAreaSeries *>(list->object); | |
62 | if (series) { |
|
57 | if (series) { | |
63 | QLineSeries *lower = series->lowerSeries(); |
|
58 | QLineSeries *lower = series->lowerSeries(); | |
64 | lower->append(element->x(), element->y()); |
|
59 | lower->append(element->x(), element->y()); | |
65 | } |
|
60 | } | |
66 | } |
|
61 | } | |
67 |
|
62 | |||
68 | #include "moc_declarativeareaseries.cpp" |
|
63 | #include "moc_declarativeareaseries.cpp" | |
69 |
|
64 | |||
70 | QTCOMMERCIALCHART_END_NAMESPACE |
|
65 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,53 +1,52 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVEAREASERIES_H |
|
21 | #ifndef DECLARATIVEAREASERIES_H | |
22 | #define DECLARATIVEAREASERIES_H |
|
22 | #define DECLARATIVEAREASERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qareaseries.h" |
|
25 | #include "qareaseries.h" | |
26 | #include "declarativexyseries.h" |
|
26 | #include "declarativexyseries.h" | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | class DeclarativeAreaSeries : public QAreaSeries, public DeclarativeXySeries |
|
30 | class DeclarativeAreaSeries : public QAreaSeries, public DeclarativeXySeries | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) |
|
33 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) | |
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> lowerPoints READ lowerPoints) |
|
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> lowerPoints READ lowerPoints) | |
35 |
|
35 | |||
36 | public: |
|
36 | public: | |
37 | explicit DeclarativeAreaSeries(QObject *parent = 0); |
|
37 | explicit DeclarativeAreaSeries(QObject *parent = 0); | |
38 |
|
38 | |||
39 | public: |
|
39 | public: | |
40 | QAbstractSeries *series(); |
|
|||
41 | QDeclarativeListProperty<DeclarativeXyPoint> points(); |
|
40 | QDeclarativeListProperty<DeclarativeXyPoint> points(); | |
42 | QDeclarativeListProperty<DeclarativeXyPoint> lowerPoints(); |
|
41 | QDeclarativeListProperty<DeclarativeXyPoint> lowerPoints(); | |
43 |
|
42 | |||
44 | public Q_SLOTS: |
|
43 | public Q_SLOTS: | |
45 | static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, |
|
44 | static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
46 | DeclarativeXyPoint *element); |
|
45 | DeclarativeXyPoint *element); | |
47 | static void appendLowerPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, |
|
46 | static void appendLowerPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
48 | DeclarativeXyPoint *element); |
|
47 | DeclarativeXyPoint *element); | |
49 | }; |
|
48 | }; | |
50 |
|
49 | |||
51 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | QTCOMMERCIALCHART_END_NAMESPACE | |
52 |
|
51 | |||
53 | #endif // DECLARATIVEAREASERIES_H |
|
52 | #endif // DECLARATIVEAREASERIES_H |
@@ -1,114 +1,135 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativechart.h" |
|
21 | #include "declarativechart.h" | |
|
22 | #include "declarativepieseries.h" | |||
22 | #include <QPainter> |
|
23 | #include <QPainter> | |
23 |
|
24 | |||
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
25 |
|
26 | |||
26 | DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent) |
|
27 | DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent) | |
27 | : QDeclarativeItem(parent), |
|
28 | : QDeclarativeItem(parent), | |
28 | m_chart(new QChart(this)), |
|
29 | m_chart(new QChart(this)), | |
29 | m_legend(LegendDisabled) |
|
30 | m_legend(LegendDisabled) | |
30 | { |
|
31 | { | |
31 | setFlag(QGraphicsItem::ItemHasNoContents, false); |
|
32 | setFlag(QGraphicsItem::ItemHasNoContents, false); | |
32 | } |
|
33 | } | |
33 |
|
34 | |||
34 | DeclarativeChart::~DeclarativeChart() |
|
35 | DeclarativeChart::~DeclarativeChart() | |
35 | { |
|
36 | { | |
36 | delete m_chart; |
|
37 | delete m_chart; | |
37 | } |
|
38 | } | |
38 |
|
39 | |||
|
40 | void DeclarativeChart::childEvent(QChildEvent *event) | |||
|
41 | { | |||
|
42 | if (event->type() == QEvent::ChildAdded) { | |||
|
43 | if (qobject_cast<QAbstractSeries *>(event->child())) { | |||
|
44 | m_chart->addSeries(qobject_cast<QAbstractSeries *>(event->child())); | |||
|
45 | } | |||
|
46 | } | |||
|
47 | } | |||
|
48 | ||||
|
49 | void DeclarativeChart::componentComplete() | |||
|
50 | { | |||
|
51 | foreach(QObject *child, children()) { | |||
|
52 | if (qobject_cast<QAbstractSeries *>(child)) { | |||
|
53 | m_chart->addSeries(qobject_cast<QAbstractSeries *>(child)); | |||
|
54 | } | |||
|
55 | } | |||
|
56 | ||||
|
57 | QDeclarativeItem::componentComplete(); | |||
|
58 | } | |||
|
59 | ||||
39 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
|
60 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) | |
40 | { |
|
61 | { | |
41 | Q_UNUSED(oldGeometry) |
|
62 | Q_UNUSED(oldGeometry) | |
42 |
|
63 | |||
43 | if (newGeometry.isValid()) { |
|
64 | if (newGeometry.isValid()) { | |
44 | if (newGeometry.width() > 0 && newGeometry.height() > 0) { |
|
65 | if (newGeometry.width() > 0 && newGeometry.height() > 0) { | |
45 | m_chart->resize(newGeometry.width(), newGeometry.height()); |
|
66 | m_chart->resize(newGeometry.width(), newGeometry.height()); | |
46 | } |
|
67 | } | |
47 | } |
|
68 | } | |
48 | } |
|
69 | } | |
49 |
|
70 | |||
50 | void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
71 | void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
51 | { |
|
72 | { | |
52 | Q_UNUSED(option) |
|
73 | Q_UNUSED(option) | |
53 | Q_UNUSED(widget) |
|
74 | Q_UNUSED(widget) | |
54 |
|
75 | |||
55 | // TODO: optimized? |
|
76 | // TODO: optimized? | |
56 | painter->setRenderHint(QPainter::Antialiasing, true); |
|
77 | painter->setRenderHint(QPainter::Antialiasing, true); | |
57 | } |
|
78 | } | |
58 |
|
79 | |||
59 | void DeclarativeChart::setAnimationOptions(QChart::AnimationOption animations) |
|
80 | void DeclarativeChart::setAnimationOptions(QChart::AnimationOption animations) | |
60 | { |
|
81 | { | |
61 | m_chart->setAnimationOptions(animations); |
|
82 | m_chart->setAnimationOptions(animations); | |
62 | } |
|
83 | } | |
63 |
|
84 | |||
64 | QChart::AnimationOption DeclarativeChart::animationOptions() |
|
85 | QChart::AnimationOption DeclarativeChart::animationOptions() | |
65 | { |
|
86 | { | |
66 | if (m_chart->animationOptions().testFlag(QChart::AllAnimations)) |
|
87 | if (m_chart->animationOptions().testFlag(QChart::AllAnimations)) | |
67 | return QChart::AllAnimations; |
|
88 | return QChart::AllAnimations; | |
68 | else if (m_chart->animationOptions().testFlag(QChart::GridAxisAnimations)) |
|
89 | else if (m_chart->animationOptions().testFlag(QChart::GridAxisAnimations)) | |
69 | return QChart::GridAxisAnimations; |
|
90 | return QChart::GridAxisAnimations; | |
70 | else if (m_chart->animationOptions().testFlag(QChart::SeriesAnimations)) |
|
91 | else if (m_chart->animationOptions().testFlag(QChart::SeriesAnimations)) | |
71 | return QChart::SeriesAnimations; |
|
92 | return QChart::SeriesAnimations; | |
72 | else |
|
93 | else | |
73 | return QChart::NoAnimation; |
|
94 | return QChart::NoAnimation; | |
74 | } |
|
95 | } | |
75 |
|
96 | |||
76 | void DeclarativeChart::setLegend(ChartLegend legend) |
|
97 | void DeclarativeChart::setLegend(ChartLegend legend) | |
77 | { |
|
98 | { | |
78 | if (legend != m_legend) { |
|
99 | if (legend != m_legend) { | |
79 | m_legend = legend; |
|
100 | m_legend = legend; | |
80 | switch (m_legend) { |
|
101 | switch (m_legend) { | |
81 | case LegendDisabled: |
|
102 | case LegendDisabled: | |
82 | m_chart->legend()->setVisible(false); |
|
103 | m_chart->legend()->setVisible(false); | |
83 | break; |
|
104 | break; | |
84 | case LegendTop: |
|
105 | case LegendTop: | |
85 | m_chart->legend()->setVisible(true); |
|
106 | m_chart->legend()->setVisible(true); | |
86 | m_chart->legend()->setAlignment(QLegend::AlignmentTop); |
|
107 | m_chart->legend()->setAlignment(QLegend::AlignmentTop); | |
87 | break; |
|
108 | break; | |
88 | case LegendBottom: |
|
109 | case LegendBottom: | |
89 | m_chart->legend()->setVisible(true); |
|
110 | m_chart->legend()->setVisible(true); | |
90 | m_chart->legend()->setAlignment(QLegend::AlignmentBottom); |
|
111 | m_chart->legend()->setAlignment(QLegend::AlignmentBottom); | |
91 | break; |
|
112 | break; | |
92 | case LegendLeft: |
|
113 | case LegendLeft: | |
93 | m_chart->legend()->setVisible(true); |
|
114 | m_chart->legend()->setVisible(true); | |
94 | m_chart->legend()->setAlignment(QLegend::AlignmentLeft); |
|
115 | m_chart->legend()->setAlignment(QLegend::AlignmentLeft); | |
95 | break; |
|
116 | break; | |
96 | case LegendRight: |
|
117 | case LegendRight: | |
97 | m_chart->legend()->setVisible(true); |
|
118 | m_chart->legend()->setVisible(true); | |
98 | m_chart->legend()->setAlignment(QLegend::AlignmentRight); |
|
119 | m_chart->legend()->setAlignment(QLegend::AlignmentRight); | |
99 | break; |
|
120 | break; | |
100 | default: |
|
121 | default: | |
101 | m_chart->legend()->setVisible(false); |
|
122 | m_chart->legend()->setVisible(false); | |
102 | break; |
|
123 | break; | |
103 | } |
|
124 | } | |
104 | } |
|
125 | } | |
105 | } |
|
126 | } | |
106 |
|
127 | |||
107 | DeclarativeChart::ChartLegend DeclarativeChart::legend() |
|
128 | DeclarativeChart::ChartLegend DeclarativeChart::legend() | |
108 | { |
|
129 | { | |
109 | return m_legend; |
|
130 | return m_legend; | |
110 | } |
|
131 | } | |
111 |
|
132 | |||
112 | #include "moc_declarativechart.cpp" |
|
133 | #include "moc_declarativechart.cpp" | |
113 |
|
134 | |||
114 | QTCOMMERCIALCHART_END_NAMESPACE |
|
135 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,78 +1,80 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVECHART_H |
|
21 | #ifndef DECLARATIVECHART_H | |
22 | #define DECLARATIVECHART_H |
|
22 | #define DECLARATIVECHART_H | |
23 |
|
23 | |||
24 | #include <QtCore/QtGlobal> |
|
24 | #include <QtCore/QtGlobal> | |
25 | #include <QDeclarativeItem> |
|
25 | #include <QDeclarativeItem> | |
26 | #include <qchart.h> |
|
26 | #include <qchart.h> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | // TODO: Derive from QChart for easier definition of properties? |
|
30 | // TODO: Derive from QChart for easier definition of properties? | |
31 | class DeclarativeChart : public QDeclarativeItem |
|
31 | class DeclarativeChart : public QDeclarativeItem | |
32 | // TODO: for QTQUICK2: extend QQuickPainterItem instead |
|
32 | // TODO: for QTQUICK2: extend QQuickPainterItem instead | |
33 | //class DeclarativeChart : public QQuickPaintedItem, public Chart |
|
33 | //class DeclarativeChart : public QQuickPaintedItem, public Chart | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) |
|
36 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) | |
37 | Q_PROPERTY(QChart::AnimationOption animationOptions READ animationOptions WRITE setAnimationOptions) |
|
37 | Q_PROPERTY(QChart::AnimationOption animationOptions READ animationOptions WRITE setAnimationOptions) | |
38 | Q_PROPERTY(QString title READ title WRITE setTitle) |
|
38 | Q_PROPERTY(QString title READ title WRITE setTitle) | |
39 | Q_PROPERTY(ChartLegend legend READ legend WRITE setLegend) |
|
39 | Q_PROPERTY(ChartLegend legend READ legend WRITE setLegend) | |
40 | Q_ENUMS(ChartLegend) |
|
40 | Q_ENUMS(ChartLegend) | |
41 |
|
41 | |||
42 | public: |
|
42 | public: | |
43 | enum ChartLegend { |
|
43 | enum ChartLegend { | |
44 | LegendDisabled = 0, |
|
44 | LegendDisabled = 0, | |
45 | LegendTop, |
|
45 | LegendTop, | |
46 | LegendBottom, |
|
46 | LegendBottom, | |
47 | LegendLeft, |
|
47 | LegendLeft, | |
48 | LegendRight |
|
48 | LegendRight | |
49 | }; |
|
49 | }; | |
50 |
|
50 | |||
51 | public: |
|
51 | public: | |
52 | DeclarativeChart(QDeclarativeItem *parent = 0); |
|
52 | DeclarativeChart(QDeclarativeItem *parent = 0); | |
53 | ~DeclarativeChart(); |
|
53 | ~DeclarativeChart(); | |
54 |
|
54 | |||
55 | public: // From QDeclarativeItem/QGraphicsItem |
|
55 | public: // From QDeclarativeItem/QGraphicsItem | |
|
56 | void childEvent(QChildEvent *event); | |||
|
57 | void componentComplete(); | |||
56 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); |
|
58 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); | |
57 | void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
59 | void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | |
58 |
|
60 | |||
59 | public: |
|
61 | public: | |
60 | void setTheme(QChart::ChartTheme theme) {m_chart->setTheme(theme);} |
|
62 | void setTheme(QChart::ChartTheme theme) {m_chart->setTheme(theme);} | |
61 | QChart::ChartTheme theme() {return m_chart->theme();} |
|
63 | QChart::ChartTheme theme() {return m_chart->theme();} | |
62 | void setAnimationOptions(QChart::AnimationOption animations); |
|
64 | void setAnimationOptions(QChart::AnimationOption animations); | |
63 | QChart::AnimationOption animationOptions(); |
|
65 | QChart::AnimationOption animationOptions(); | |
64 | void setTitle(QString title) {m_chart->setTitle(title);} |
|
66 | void setTitle(QString title) {m_chart->setTitle(title);} | |
65 | QString title() { return m_chart->title();} |
|
67 | QString title() { return m_chart->title();} | |
66 | void setLegend(ChartLegend legend); |
|
68 | void setLegend(ChartLegend legend); | |
67 | ChartLegend legend(); |
|
69 | ChartLegend legend(); | |
68 |
|
70 | |||
69 | public: |
|
71 | public: | |
70 | // Extending QChart with DeclarativeChart is not possible because QObject does not support |
|
72 | // Extending QChart with DeclarativeChart is not possible because QObject does not support | |
71 | // multi inheritance, so we now have a QChart as a member instead |
|
73 | // multi inheritance, so we now have a QChart as a member instead | |
72 | QChart *m_chart; |
|
74 | QChart *m_chart; | |
73 | ChartLegend m_legend; |
|
75 | ChartLegend m_legend; | |
74 | }; |
|
76 | }; | |
75 |
|
77 | |||
76 | QTCOMMERCIALCHART_END_NAMESPACE |
|
78 | QTCOMMERCIALCHART_END_NAMESPACE | |
77 |
|
79 | |||
78 | #endif // DECLARATIVECHART_H |
|
80 | #endif // DECLARATIVECHART_H |
@@ -1,45 +1,40 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativelineseries.h" |
|
21 | #include "declarativelineseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qlineseries.h" |
|
24 | #include "qlineseries.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) : |
|
28 | DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) : | |
29 | QLineSeries(parent) |
|
29 | QLineSeries(parent) | |
30 | { |
|
30 | { | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | QAbstractSeries *DeclarativeLineSeries::series() |
|
|||
34 | { |
|
|||
35 | return this; |
|
|||
36 | } |
|
|||
37 |
|
||||
38 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeLineSeries::points() |
|
33 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeLineSeries::points() | |
39 | { |
|
34 | { | |
40 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); |
|
35 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); | |
41 | } |
|
36 | } | |
42 |
|
37 | |||
43 | #include "moc_declarativelineseries.cpp" |
|
38 | #include "moc_declarativelineseries.cpp" | |
44 |
|
39 | |||
45 | QTCOMMERCIALCHART_END_NAMESPACE |
|
40 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,46 +1,45 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVELINESERIES_H |
|
21 | #ifndef DECLARATIVELINESERIES_H | |
22 | #define DECLARATIVELINESERIES_H |
|
22 | #define DECLARATIVELINESERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qlineseries.h" |
|
25 | #include "qlineseries.h" | |
26 | #include "declarativexyseries.h" |
|
26 | #include "declarativexyseries.h" | |
27 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries |
|
31 | class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) |
|
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) | |
35 |
|
35 | |||
36 | public: |
|
36 | public: | |
37 | explicit DeclarativeLineSeries(QObject *parent = 0); |
|
37 | explicit DeclarativeLineSeries(QObject *parent = 0); | |
38 |
|
38 | |||
39 | public: |
|
39 | public: | |
40 | QAbstractSeries *series(); |
|
|||
41 | QDeclarativeListProperty<DeclarativeXyPoint> points(); |
|
40 | QDeclarativeListProperty<DeclarativeXyPoint> points(); | |
42 | }; |
|
41 | }; | |
43 |
|
42 | |||
44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
43 | QTCOMMERCIALCHART_END_NAMESPACE | |
45 |
|
44 | |||
46 | #endif // DECLARATIVELINESERIES_H |
|
45 | #endif // DECLARATIVELINESERIES_H |
@@ -1,62 +1,47 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativepieseries.h" |
|
21 | #include "declarativepieseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | DeclarativePieSeries::DeclarativePieSeries(QObject *parent) : |
|
27 | DeclarativePieSeries::DeclarativePieSeries(QObject *parent) : | |
28 |
QPieSeries(parent) |
|
28 | QPieSeries(parent) | |
29 | m_chart(0) |
|
|||
30 | { |
|
29 | { | |
31 | } |
|
30 | } | |
32 |
|
31 | |||
33 | void DeclarativePieSeries::classBegin() |
|
|||
34 | { |
|
|||
35 | } |
|
|||
36 |
|
||||
37 | void DeclarativePieSeries::componentComplete() |
|
|||
38 | { |
|
|||
39 | DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent()); |
|
|||
40 | if (declarativeChart) { |
|
|||
41 | QChart *chart = qobject_cast<QChart *>(declarativeChart->m_chart); |
|
|||
42 | Q_ASSERT(chart); |
|
|||
43 | chart->addSeries(this); |
|
|||
44 | } |
|
|||
45 | } |
|
|||
46 |
|
||||
47 | QDeclarativeListProperty<QPieSlice> DeclarativePieSeries::slices() |
|
32 | QDeclarativeListProperty<QPieSlice> DeclarativePieSeries::slices() | |
48 | { |
|
33 | { | |
49 | return QDeclarativeListProperty<QPieSlice>(this, 0, &DeclarativePieSeries::appendSlice); |
|
34 | return QDeclarativeListProperty<QPieSlice>(this, 0, &DeclarativePieSeries::appendSlice); | |
50 | } |
|
35 | } | |
51 |
|
36 | |||
52 | void DeclarativePieSeries::appendSlice(QDeclarativeListProperty<QPieSlice> *list, |
|
37 | void DeclarativePieSeries::appendSlice(QDeclarativeListProperty<QPieSlice> *list, | |
53 | QPieSlice *slice) |
|
38 | QPieSlice *slice) | |
54 | { |
|
39 | { | |
55 | DeclarativePieSeries *series = qobject_cast<DeclarativePieSeries *>(list->object); |
|
40 | DeclarativePieSeries *series = qobject_cast<DeclarativePieSeries *>(list->object); | |
56 | if (series) |
|
41 | if (series) | |
57 | series->append(slice->value(), slice->label()); |
|
42 | series->append(slice->value(), slice->label()); | |
58 | } |
|
43 | } | |
59 |
|
44 | |||
60 | #include "moc_declarativepieseries.cpp" |
|
45 | #include "moc_declarativepieseries.cpp" | |
61 |
|
46 | |||
62 | QTCOMMERCIALCHART_END_NAMESPACE |
|
47 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,57 +1,49 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVEPIESERIES_H |
|
21 | #ifndef DECLARATIVEPIESERIES_H | |
22 | #define DECLARATIVEPIESERIES_H |
|
22 | #define DECLARATIVEPIESERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qpieslice.h" |
|
25 | #include "qpieslice.h" | |
26 | #include "qpieseries.h" |
|
26 | #include "qpieseries.h" | |
27 |
#include <QDeclarative |
|
27 | #include <QDeclarativeListProperty> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | class QChart; |
|
31 | class QChart; | |
32 |
|
32 | |||
33 |
class DeclarativePieSeries : public QPieSeries |
|
33 | class DeclarativePieSeries : public QPieSeries | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | Q_INTERFACES(QDeclarativeParserStatus) |
|
|||
37 | Q_PROPERTY(QDeclarativeListProperty<QPieSlice> slices READ slices) |
|
36 | Q_PROPERTY(QDeclarativeListProperty<QPieSlice> slices READ slices) | |
38 |
|
37 | |||
39 | public: |
|
38 | public: | |
40 | explicit DeclarativePieSeries(QObject *parent = 0); |
|
39 | explicit DeclarativePieSeries(QObject *parent = 0); | |
41 | QDeclarativeListProperty<QPieSlice> slices(); |
|
40 | QDeclarativeListProperty<QPieSlice> slices(); | |
42 |
|
41 | |||
43 | public: // from QDeclarativeParserStatus |
|
|||
44 | void classBegin(); |
|
|||
45 | void componentComplete(); |
|
|||
46 |
|
||||
47 | public Q_SLOTS: |
|
42 | public Q_SLOTS: | |
48 | static void appendSlice(QDeclarativeListProperty<QPieSlice> *list, |
|
43 | static void appendSlice(QDeclarativeListProperty<QPieSlice> *list, | |
49 | QPieSlice *element); |
|
44 | QPieSlice *element); | |
50 |
|
||||
51 | private: |
|
|||
52 | QChart *m_chart; |
|
|||
53 | }; |
|
45 | }; | |
54 |
|
46 | |||
55 | QTCOMMERCIALCHART_END_NAMESPACE |
|
47 | QTCOMMERCIALCHART_END_NAMESPACE | |
56 |
|
48 | |||
57 | #endif // DECLARATIVEPIESERIES_H |
|
49 | #endif // DECLARATIVEPIESERIES_H |
@@ -1,45 +1,40 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativescatterseries.h" |
|
21 | #include "declarativescatterseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qscatterseries.h" |
|
24 | #include "qscatterseries.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) : |
|
28 | DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) : | |
29 | QScatterSeries(parent) |
|
29 | QScatterSeries(parent) | |
30 | { |
|
30 | { | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | QAbstractSeries *DeclarativeScatterSeries::series() |
|
|||
34 | { |
|
|||
35 | return this; |
|
|||
36 | } |
|
|||
37 |
|
||||
38 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeScatterSeries::points() |
|
33 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeScatterSeries::points() | |
39 | { |
|
34 | { | |
40 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); |
|
35 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); | |
41 | } |
|
36 | } | |
42 |
|
37 | |||
43 | #include "moc_declarativescatterseries.cpp" |
|
38 | #include "moc_declarativescatterseries.cpp" | |
44 |
|
39 | |||
45 | QTCOMMERCIALCHART_END_NAMESPACE |
|
40 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,46 +1,45 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVESCATTERSERIES_H |
|
21 | #ifndef DECLARATIVESCATTERSERIES_H | |
22 | #define DECLARATIVESCATTERSERIES_H |
|
22 | #define DECLARATIVESCATTERSERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qscatterseries.h" |
|
25 | #include "qscatterseries.h" | |
26 | #include "declarativexyseries.h" |
|
26 | #include "declarativexyseries.h" | |
27 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries |
|
31 | class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) |
|
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) | |
35 |
|
35 | |||
36 | public: |
|
36 | public: | |
37 | explicit DeclarativeScatterSeries(QObject *parent = 0); |
|
37 | explicit DeclarativeScatterSeries(QObject *parent = 0); | |
38 |
|
38 | |||
39 | public: |
|
39 | public: | |
40 | QAbstractSeries *series(); |
|
|||
41 | QDeclarativeListProperty<DeclarativeXyPoint> points(); |
|
40 | QDeclarativeListProperty<DeclarativeXyPoint> points(); | |
42 | }; |
|
41 | }; | |
43 |
|
42 | |||
44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
43 | QTCOMMERCIALCHART_END_NAMESPACE | |
45 |
|
44 | |||
46 | #endif // DECLARATIVESCATTERSERIES_H |
|
45 | #endif // DECLARATIVESCATTERSERIES_H |
@@ -1,44 +1,39 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativesplineseries.h" |
|
21 | #include "declarativesplineseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) : |
|
27 | DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) : | |
28 | QSplineSeries(parent) |
|
28 | QSplineSeries(parent) | |
29 | { |
|
29 | { | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | QAbstractSeries *DeclarativeSplineSeries::series() |
|
|||
33 | { |
|
|||
34 | return this; |
|
|||
35 | } |
|
|||
36 |
|
||||
37 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeSplineSeries::points() |
|
32 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeSplineSeries::points() | |
38 | { |
|
33 | { | |
39 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); |
|
34 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); | |
40 | } |
|
35 | } | |
41 |
|
36 | |||
42 | #include "moc_declarativesplineseries.cpp" |
|
37 | #include "moc_declarativesplineseries.cpp" | |
43 |
|
38 | |||
44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
39 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,46 +1,45 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVESPLINESERIES_H |
|
21 | #ifndef DECLARATIVESPLINESERIES_H | |
22 | #define DECLARATIVESPLINESERIES_H |
|
22 | #define DECLARATIVESPLINESERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qsplineseries.h" |
|
25 | #include "qsplineseries.h" | |
26 | #include "declarativexyseries.h" |
|
26 | #include "declarativexyseries.h" | |
27 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries |
|
31 | class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) |
|
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) | |
35 |
|
35 | |||
36 | public: |
|
36 | public: | |
37 | explicit DeclarativeSplineSeries(QObject *parent = 0); |
|
37 | explicit DeclarativeSplineSeries(QObject *parent = 0); | |
38 |
|
38 | |||
39 | public: |
|
39 | public: | |
40 | QAbstractSeries *series(); |
|
|||
41 | QDeclarativeListProperty<DeclarativeXyPoint> points(); |
|
40 | QDeclarativeListProperty<DeclarativeXyPoint> points(); | |
42 | }; |
|
41 | }; | |
43 |
|
42 | |||
44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
43 | QTCOMMERCIALCHART_END_NAMESPACE | |
45 |
|
44 | |||
46 | #endif // DECLARATIVESPLINESERIES_H |
|
45 | #endif // DECLARATIVESPLINESERIES_H |
@@ -1,60 +1,44 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | //#include "DeclarativeXySeries.h" |
|
21 | //#include "DeclarativeXySeries.h" | |
22 | #include "declarativexyseries.h" |
|
22 | #include "declarativexyseries.h" | |
23 | #include "qxyseries.h" |
|
23 | #include "qxyseries.h" | |
24 | #include "declarativechart.h" |
|
24 | #include "declarativechart.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | DeclarativeXySeries::DeclarativeXySeries() |
|
28 | DeclarativeXySeries::DeclarativeXySeries() | |
29 | { |
|
29 | { | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | DeclarativeXySeries::~DeclarativeXySeries() |
|
32 | DeclarativeXySeries::~DeclarativeXySeries() | |
33 | { |
|
33 | { | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | void DeclarativeXySeries::classBegin() |
|
|||
37 | { |
|
|||
38 | } |
|
|||
39 |
|
||||
40 | void DeclarativeXySeries::componentComplete() |
|
|||
41 | { |
|
|||
42 | QAbstractSeries *thisObj = reinterpret_cast<QAbstractSeries *>(series()); |
|
|||
43 | DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(thisObj->parent()); |
|
|||
44 |
|
||||
45 | if (declarativeChart) { |
|
|||
46 | QChart *chart = qobject_cast<QChart *>(declarativeChart->m_chart); |
|
|||
47 | Q_ASSERT(chart); |
|
|||
48 | chart->addSeries(thisObj); |
|
|||
49 | } |
|
|||
50 | } |
|
|||
51 |
|
||||
52 | void DeclarativeXySeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, |
|
36 | void DeclarativeXySeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
53 | DeclarativeXyPoint *element) |
|
37 | DeclarativeXyPoint *element) | |
54 | { |
|
38 | { | |
55 | QXYSeries *series = qobject_cast<QXYSeries *>(list->object); |
|
39 | QXYSeries *series = qobject_cast<QXYSeries *>(list->object); | |
56 | if (series) |
|
40 | if (series) | |
57 | series->append(element->x(), element->y()); |
|
41 | series->append(element->x(), element->y()); | |
58 | } |
|
42 | } | |
59 |
|
43 | |||
60 | QTCOMMERCIALCHART_END_NAMESPACE |
|
44 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,57 +1,51 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVE_XY_SERIES_H |
|
21 | #ifndef DECLARATIVE_XY_SERIES_H | |
22 | #define DECLARATIVE_XY_SERIES_H |
|
22 | #define DECLARATIVE_XY_SERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "declarativexypoint.h" |
|
25 | #include "declarativexypoint.h" | |
26 | #include <QDeclarativeParserStatus> |
|
|||
27 | #include <QDeclarativeListProperty> |
|
26 | #include <QDeclarativeListProperty> | |
28 |
|
27 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
29 | |||
31 | class QChart; |
|
30 | class QChart; | |
32 | class QAbstractSeries; |
|
31 | class QAbstractSeries; | |
33 |
|
32 | |||
34 | class DeclarativeXySeries : public QDeclarativeParserStatus |
|
33 | class DeclarativeXySeries | |
35 | { |
|
34 | { | |
36 | Q_INTERFACES(QDeclarativeParserStatus) |
|
35 | Q_INTERFACES(QDeclarativeParserStatus) | |
37 |
|
36 | |||
38 | public: |
|
37 | public: | |
39 | explicit DeclarativeXySeries(); |
|
38 | explicit DeclarativeXySeries(); | |
40 | ~DeclarativeXySeries(); |
|
39 | ~DeclarativeXySeries(); | |
41 |
|
40 | |||
42 | public: // from QDeclarativeParserStatus |
|
|||
43 | virtual void classBegin(); |
|
|||
44 | virtual void componentComplete(); |
|
|||
45 |
|
||||
46 | public: |
|
41 | public: | |
47 | virtual QAbstractSeries *series() = 0; |
|
|||
48 | virtual QDeclarativeListProperty<DeclarativeXyPoint> points() = 0; |
|
42 | virtual QDeclarativeListProperty<DeclarativeXyPoint> points() = 0; | |
49 |
|
43 | |||
50 | public Q_SLOTS: |
|
44 | public Q_SLOTS: | |
51 | static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, |
|
45 | static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
52 | DeclarativeXyPoint *element); |
|
46 | DeclarativeXyPoint *element); | |
53 | }; |
|
47 | }; | |
54 |
|
48 | |||
55 | QTCOMMERCIALCHART_END_NAMESPACE |
|
49 | QTCOMMERCIALCHART_END_NAMESPACE | |
56 |
|
50 | |||
57 | #endif // DECLARATIVE_XY_SERIES_H |
|
51 | #endif // DECLARATIVE_XY_SERIES_H |
General Comments 0
You need to be logged in to leave comments.
Login now