@@ -1,104 +1,56 | |||||
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 | property int __explodedIndex: -1 |
|
26 | property int __explodedIndex: -1 | |
27 | property variant otherSlice: 0 |
|
27 | property variant otherSlice: 0 | |
28 |
|
28 | |||
29 | ChartView { |
|
29 | ChartView { | |
30 | id: chart |
|
30 | id: chart | |
31 | title: "Top-5 car brand shares in Finland" |
|
31 | title: "Top-5 car brand shares in Finland" | |
32 |
anchors. |
|
32 | anchors.fill: parent | |
33 | anchors.bottom: button.top |
|
|||
34 | anchors.left: parent.left |
|
|||
35 | anchors.right: parent.right |
|
|||
36 | theme: ChartView.ChartThemeLight |
|
33 | theme: ChartView.ChartThemeLight | |
37 | legend: ChartView.LegendBottom |
|
34 | legend: ChartView.LegendBottom | |
38 | animationOptions: ChartView.SeriesAnimations |
|
35 | animationOptions: ChartView.SeriesAnimations | |
39 |
|
36 | |||
40 | // If you have static data, you can simply use the PieSlice API |
|
37 | // If you have static data, you can simply use the PieSlice API | |
41 | PieSeries { |
|
38 | PieSeries { | |
42 | id: pieSeries |
|
39 | id: pieSeries | |
43 | PieSlice { id: volkswagenSlice; label: "Volkswagen"; value: 13.5 } |
|
40 | onClicked: { | |
|
41 | slice.exploded = !slice.exploded; | |||
|
42 | } | |||
|
43 | PieSlice { label: "Volkswagen"; value: 13.5 } | |||
44 | PieSlice { label: "Toyota"; value: 10.9 } |
|
44 | PieSlice { label: "Toyota"; value: 10.9 } | |
45 | PieSlice { label: "Ford"; value: 8.6 } |
|
45 | PieSlice { label: "Ford"; value: 8.6 } | |
46 | PieSlice { label: "Skoda"; value: 8.2 } |
|
46 | PieSlice { label: "Skoda"; value: 8.2 } | |
47 | PieSlice { label: "Volvo"; value: 6.8 } |
|
47 | PieSlice { label: "Volvo"; value: 6.8 } | |
48 | } |
|
48 | } | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | Component.onCompleted: { |
|
51 | Component.onCompleted: { | |
52 | volkswagenSlice.exploded = true; |
|
|||
53 | // You can also add slices dynamically |
|
52 | // You can also add slices dynamically | |
54 | otherSlice = pieSeries.append("Others", 52.0); |
|
53 | otherSlice = pieSeries.append("Others", 52.0); | |
55 | } |
|
54 | pieSeries.find("Volkswagen").exploded = true; | |
56 |
|
||||
57 | Timer { |
|
|||
58 | repeat: true |
|
|||
59 | interval: 2000 |
|
|||
60 | running: true |
|
|||
61 | onTriggered: { |
|
|||
62 | // Set all slices as not exploded |
|
|||
63 | for (var i = 0; i < pieSeries.count; i++) |
|
|||
64 | pieSeries.at(i).exploded = false; |
|
|||
65 |
|
||||
66 | // Explode one of the slices |
|
|||
67 | __explodedIndex = (__explodedIndex + 1) % pieSeries.count; |
|
|||
68 | pieSeries.at(__explodedIndex).exploded = true; |
|
|||
69 |
|
||||
70 | pieSeries.find("Volkswagen").exploded = true; |
|
|||
71 | // TODO: implement for convenience |
|
|||
72 | // pieSeries.removeAll("Ford"); |
|
|||
73 | } |
|
|||
74 | } |
|
|||
75 |
|
||||
76 | Rectangle { |
|
|||
77 | id: button |
|
|||
78 | anchors.bottom: parent.bottom |
|
|||
79 | anchors.bottomMargin: 10 |
|
|||
80 | anchors.horizontalCenter: parent.horizontalCenter |
|
|||
81 | height: 40 |
|
|||
82 | width: 100 |
|
|||
83 | color: "orange" |
|
|||
84 | radius: 5 |
|
|||
85 | Text { |
|
|||
86 | id: buttonText |
|
|||
87 | anchors.centerIn: parent |
|
|||
88 | text: "Hide others" |
|
|||
89 | } |
|
|||
90 | MouseArea { |
|
|||
91 | anchors.fill: parent |
|
|||
92 | onClicked: { |
|
|||
93 | if (buttonText.text == "Show others") { |
|
|||
94 | buttonText.text = "Hide others"; |
|
|||
95 | // TODO: ? |
|
|||
96 | otherSlice.visible = true; |
|
|||
97 | } else { |
|
|||
98 | buttonText.text = "Show others"; |
|
|||
99 | otherSlice.visible = false; |
|
|||
100 | } |
|
|||
101 | } |
|
|||
102 | } |
|
|||
103 | } |
|
55 | } | |
104 | } |
|
56 | } |
@@ -1,130 +1,143 | |||||
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 | ChartView { |
|
27 | ChartView { | |
28 | title: "NHL All-Star Team Players" |
|
28 | title: "NHL All-Star Team Players" | |
29 | anchors.fill: parent |
|
29 | anchors.fill: parent | |
30 | theme: ChartView.ChartThemeHighContrast |
|
30 | theme: ChartView.ChartThemeHighContrast | |
31 | axisXLabels: ["0", "2000", "1", "2001", "2", "2002", "3", "2003", "4", "2004", "5", "2005", |
|
31 | axisXLabels: ["0", "2000", "1", "2001", "2", "2002", "3", "2003", "4", "2004", "5", "2005", | |
32 | "6", "2006", "7", "2007", "8", "2008", "9", "2009", "10", "2010", "11", "2011"] |
|
32 | "6", "2006", "7", "2007", "8", "2008", "9", "2009", "10", "2010", "11", "2011"] | |
33 |
|
33 | |||
34 | AreaSeries { |
|
34 | AreaSeries { | |
35 | name: "Russian" |
|
35 | name: "Russian" | |
36 | upperSeries: LineSeries { |
|
36 | upperSeries: LineSeries { | |
37 | XyPoint { x: 0; y: 1 } |
|
37 | XyPoint { x: 0; y: 1 } | |
38 | XyPoint { x: 1; y: 1 } |
|
38 | XyPoint { x: 1; y: 1 } | |
39 | XyPoint { x: 2; y: 1 } |
|
39 | XyPoint { x: 2; y: 1 } | |
40 | XyPoint { x: 3; y: 1 } |
|
40 | XyPoint { x: 3; y: 1 } | |
41 | XyPoint { x: 4; y: 1 } |
|
41 | XyPoint { x: 4; y: 1 } | |
42 | XyPoint { x: 5; y: 0 } |
|
42 | XyPoint { x: 5; y: 0 } | |
43 | XyPoint { x: 6; y: 1 } |
|
43 | XyPoint { x: 6; y: 1 } | |
44 | XyPoint { x: 7; y: 1 } |
|
44 | XyPoint { x: 7; y: 1 } | |
45 | XyPoint { x: 8; y: 4 } |
|
45 | XyPoint { x: 8; y: 4 } | |
46 | XyPoint { x: 9; y: 3 } |
|
46 | XyPoint { x: 9; y: 3 } | |
47 | XyPoint { x: 10; y: 2 } |
|
47 | XyPoint { x: 10; y: 2 } | |
48 | XyPoint { x: 11; y: 1 } |
|
48 | XyPoint { x: 11; y: 1 } | |
49 | } |
|
49 | } | |
50 | lowerSeries: LineSeries { |
|
50 | lowerSeries: LineSeries { | |
51 | XyPoint { x: 0; y: 0 } |
|
51 | XyPoint { x: 0; y: 0 } | |
52 | XyPoint { x: 1; y: 0 } |
|
52 | XyPoint { x: 1; y: 0 } | |
53 | XyPoint { x: 2; y: 0 } |
|
53 | XyPoint { x: 2; y: 0 } | |
54 | XyPoint { x: 3; y: 0 } |
|
54 | XyPoint { x: 3; y: 0 } | |
55 | XyPoint { x: 4; y: 0 } |
|
55 | XyPoint { x: 4; y: 0 } | |
56 | XyPoint { x: 5; y: 0 } |
|
56 | XyPoint { x: 5; y: 0 } | |
57 | XyPoint { x: 6; y: 0 } |
|
57 | XyPoint { x: 6; y: 0 } | |
58 | XyPoint { x: 7; y: 0 } |
|
58 | XyPoint { x: 7; y: 0 } | |
59 | XyPoint { x: 8; y: 0 } |
|
59 | XyPoint { x: 8; y: 0 } | |
60 | XyPoint { x: 9; y: 0 } |
|
60 | XyPoint { x: 9; y: 0 } | |
61 | XyPoint { x: 10; y: 0 } |
|
61 | XyPoint { x: 10; y: 0 } | |
62 | XyPoint { x: 11; y: 0 } |
|
62 | XyPoint { x: 11; y: 0 } | |
63 | } |
|
63 | } | |
|
64 | onClicked: { | |||
|
65 | color = "red"; | |||
|
66 | borderColor = "black"; | |||
|
67 | } | |||
64 | } |
|
68 | } | |
65 |
|
69 | |||
66 | AreaSeries { |
|
70 | AreaSeries { | |
|
71 | id: swedish | |||
67 | name: "Swedish" |
|
72 | name: "Swedish" | |
68 | upperSeries: LineSeries { |
|
73 | upperSeries: LineSeries { | |
69 | XyPoint { x: 0; y: 1 } |
|
74 | XyPoint { x: 0; y: 1 } | |
70 | XyPoint { x: 1; y: 1 } |
|
75 | XyPoint { x: 1; y: 1 } | |
71 | XyPoint { x: 2; y: 3 } |
|
76 | XyPoint { x: 2; y: 3 } | |
72 | XyPoint { x: 3; y: 3 } |
|
77 | XyPoint { x: 3; y: 3 } | |
73 | XyPoint { x: 4; y: 2 } |
|
78 | XyPoint { x: 4; y: 2 } | |
74 | XyPoint { x: 5; y: 0 } |
|
79 | XyPoint { x: 5; y: 0 } | |
75 | XyPoint { x: 6; y: 2 } |
|
80 | XyPoint { x: 6; y: 2 } | |
76 | XyPoint { x: 7; y: 1 } |
|
81 | XyPoint { x: 7; y: 1 } | |
77 | XyPoint { x: 8; y: 2 } |
|
82 | XyPoint { x: 8; y: 2 } | |
78 | XyPoint { x: 9; y: 1 } |
|
83 | XyPoint { x: 9; y: 1 } | |
79 | XyPoint { x: 10; y: 3 } |
|
84 | XyPoint { x: 10; y: 3 } | |
80 | XyPoint { x: 11; y: 3 } |
|
85 | XyPoint { x: 11; y: 3 } | |
81 | } |
|
86 | } | |
82 | lowerSeries: LineSeries { |
|
87 | lowerSeries: LineSeries { | |
83 | XyPoint { x: 0; y: 0 } |
|
88 | XyPoint { x: 0; y: 0 } | |
84 | XyPoint { x: 1; y: 0 } |
|
89 | XyPoint { x: 1; y: 0 } | |
85 | XyPoint { x: 2; y: 0 } |
|
90 | XyPoint { x: 2; y: 0 } | |
86 | XyPoint { x: 3; y: 0 } |
|
91 | XyPoint { x: 3; y: 0 } | |
87 | XyPoint { x: 4; y: 0 } |
|
92 | XyPoint { x: 4; y: 0 } | |
88 | XyPoint { x: 5; y: 0 } |
|
93 | XyPoint { x: 5; y: 0 } | |
89 | XyPoint { x: 6; y: 0 } |
|
94 | XyPoint { x: 6; y: 0 } | |
90 | XyPoint { x: 7; y: 0 } |
|
95 | XyPoint { x: 7; y: 0 } | |
91 | XyPoint { x: 8; y: 0 } |
|
96 | XyPoint { x: 8; y: 0 } | |
92 | XyPoint { x: 9; y: 0 } |
|
97 | XyPoint { x: 9; y: 0 } | |
93 | XyPoint { x: 10; y: 0 } |
|
98 | XyPoint { x: 10; y: 0 } | |
94 | XyPoint { x: 11; y: 0 } |
|
99 | XyPoint { x: 11; y: 0 } | |
95 | } |
|
100 | } | |
|
101 | onClicked: { | |||
|
102 | color = "yellow"; | |||
|
103 | borderColor = "blue"; | |||
|
104 | } | |||
96 | } |
|
105 | } | |
97 |
|
106 | |||
98 | AreaSeries { |
|
107 | AreaSeries { | |
99 | name: "Finnish" |
|
108 | name: "Finnish" | |
100 | upperSeries: LineSeries { |
|
109 | upperSeries: LineSeries { | |
101 | XyPoint { x: 0; y: 0 } |
|
110 | XyPoint { x: 0; y: 0 } | |
102 | XyPoint { x: 1; y: 0 } |
|
111 | XyPoint { x: 1; y: 0 } | |
103 | XyPoint { x: 2; y: 0 } |
|
112 | XyPoint { x: 2; y: 0 } | |
104 | XyPoint { x: 3; y: 0 } |
|
113 | XyPoint { x: 3; y: 0 } | |
105 | XyPoint { x: 4; y: 0 } |
|
114 | XyPoint { x: 4; y: 0 } | |
106 | XyPoint { x: 5; y: 0 } |
|
115 | XyPoint { x: 5; y: 0 } | |
107 | XyPoint { x: 6; y: 1 } |
|
116 | XyPoint { x: 6; y: 1 } | |
108 | XyPoint { x: 7; y: 0 } |
|
117 | XyPoint { x: 7; y: 0 } | |
109 | XyPoint { x: 8; y: 0 } |
|
118 | XyPoint { x: 8; y: 0 } | |
110 | XyPoint { x: 9; y: 0 } |
|
119 | XyPoint { x: 9; y: 0 } | |
111 | XyPoint { x: 10; y: 0 } |
|
120 | XyPoint { x: 10; y: 0 } | |
112 | XyPoint { x: 11; y: 1 } |
|
121 | XyPoint { x: 11; y: 1 } | |
113 | } |
|
122 | } | |
114 | lowerSeries: LineSeries { |
|
123 | lowerSeries: LineSeries { | |
115 | XyPoint { x: 0; y: 0 } |
|
124 | XyPoint { x: 0; y: 0 } | |
116 | XyPoint { x: 1; y: 0 } |
|
125 | XyPoint { x: 1; y: 0 } | |
117 | XyPoint { x: 2; y: 0 } |
|
126 | XyPoint { x: 2; y: 0 } | |
118 | XyPoint { x: 3; y: 0 } |
|
127 | XyPoint { x: 3; y: 0 } | |
119 | XyPoint { x: 4; y: 0 } |
|
128 | XyPoint { x: 4; y: 0 } | |
120 | XyPoint { x: 5; y: 0 } |
|
129 | XyPoint { x: 5; y: 0 } | |
121 | XyPoint { x: 6; y: 0 } |
|
130 | XyPoint { x: 6; y: 0 } | |
122 | XyPoint { x: 7; y: 0 } |
|
131 | XyPoint { x: 7; y: 0 } | |
123 | XyPoint { x: 8; y: 0 } |
|
132 | XyPoint { x: 8; y: 0 } | |
124 | XyPoint { x: 9; y: 0 } |
|
133 | XyPoint { x: 9; y: 0 } | |
125 | XyPoint { x: 10; y: 0 } |
|
134 | XyPoint { x: 10; y: 0 } | |
126 | XyPoint { x: 11; y: 0 } |
|
135 | XyPoint { x: 11; y: 0 } | |
127 | } |
|
136 | } | |
|
137 | onClicked: { | |||
|
138 | color = "white"; | |||
|
139 | borderColor = "blue"; | |||
|
140 | } | |||
128 | } |
|
141 | } | |
129 | } |
|
142 | } | |
130 | } |
|
143 | } |
@@ -1,41 +1,86 | |||||
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 |
|
27 | property int viewNumber: 1 | |
28 |
|
||||
29 | MouseArea { |
|
|||
30 | anchors.fill: parent |
|
|||
31 | onClicked: { |
|
|||
32 | __viewNumber++; |
|
|||
33 | } |
|
|||
34 | } |
|
|||
35 |
|
28 | |||
36 | Loader { |
|
29 | Loader { | |
37 | id: loader |
|
30 | id: loader | |
38 |
anchors. |
|
31 | anchors.top: parent.top | |
39 | source: "View" + (__viewNumber % 5 + 1) + ".qml"; |
|
32 | anchors.bottom: buttons.top | |
|
33 | anchors.left: parent.left | |||
|
34 | anchors.right: parent.right | |||
|
35 | source: "View" + viewNumber + ".qml"; | |||
|
36 | } | |||
|
37 | ||||
|
38 | Row { | |||
|
39 | id: buttons | |||
|
40 | anchors.bottom: parent.bottom | |||
|
41 | anchors.bottomMargin: 5 | |||
|
42 | anchors.horizontalCenter: parent.horizontalCenter | |||
|
43 | spacing: 10 | |||
|
44 | ||||
|
45 | Rectangle { | |||
|
46 | height: 35 | |||
|
47 | width: 55 | |||
|
48 | color: "grey" | |||
|
49 | radius: 5 | |||
|
50 | Text { | |||
|
51 | anchors.centerIn: parent | |||
|
52 | text: "previous" | |||
|
53 | } | |||
|
54 | MouseArea { | |||
|
55 | anchors.fill: parent | |||
|
56 | onClicked: { | |||
|
57 | var i = viewNumber - 1; | |||
|
58 | if (i <= 0) | |||
|
59 | viewNumber = 5; | |||
|
60 | else | |||
|
61 | viewNumber = i; | |||
|
62 | } | |||
|
63 | } | |||
|
64 | } | |||
|
65 | Rectangle { | |||
|
66 | height: 35 | |||
|
67 | width: 55 | |||
|
68 | color: "grey" | |||
|
69 | radius: 5 | |||
|
70 | Text { | |||
|
71 | anchors.centerIn: parent | |||
|
72 | text: "next" | |||
|
73 | } | |||
|
74 | MouseArea { | |||
|
75 | anchors.fill: parent | |||
|
76 | onClicked: { | |||
|
77 | var i = viewNumber + 1; | |||
|
78 | if (i > 5) | |||
|
79 | viewNumber = 1; | |||
|
80 | else | |||
|
81 | viewNumber = i; | |||
|
82 | } | |||
|
83 | } | |||
|
84 | } | |||
40 | } |
|
85 | } | |
41 | } |
|
86 | } |
@@ -1,100 +1,101 | |||||
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 <QtDeclarative/qdeclarativeextensionplugin.h> |
|
21 | #include <QtDeclarative/qdeclarativeextensionplugin.h> | |
22 | #include <QtDeclarative/qdeclarative.h> |
|
22 | #include <QtDeclarative/qdeclarative.h> | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qaxiscategories.h" |
|
24 | #include "qaxiscategories.h" | |
25 | #include "declarativechart.h" |
|
25 | #include "declarativechart.h" | |
26 | #include "declarativexypoint.h" |
|
26 | #include "declarativexypoint.h" | |
27 | #include "declarativelineseries.h" |
|
27 | #include "declarativelineseries.h" | |
28 | #include "declarativesplineseries.h" |
|
28 | #include "declarativesplineseries.h" | |
29 | #include "declarativeareaseries.h" |
|
29 | #include "declarativeareaseries.h" | |
30 | #include "declarativescatterseries.h" |
|
30 | #include "declarativescatterseries.h" | |
31 | #include "declarativebarseries.h" |
|
31 | #include "declarativebarseries.h" | |
32 | #include "declarativepieseries.h" |
|
32 | #include "declarativepieseries.h" | |
33 | #include <QVXYModelMapper> |
|
33 | #include <QVXYModelMapper> | |
34 | #include <QHXYModelMapper> |
|
34 | #include <QHXYModelMapper> | |
35 | #include <QHPieModelMapper> |
|
35 | #include <QHPieModelMapper> | |
36 | #include <QVPieModelMapper> |
|
36 | #include <QVPieModelMapper> | |
37 | #include <QHBarModelMapper> |
|
37 | #include <QHBarModelMapper> | |
38 | #include <QVBarModelMapper> |
|
38 | #include <QVBarModelMapper> | |
39 |
|
39 | |||
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
41 |
|
41 | |||
42 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin |
|
42 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin | |
43 | { |
|
43 | { | |
44 | Q_OBJECT |
|
44 | Q_OBJECT | |
45 | public: |
|
45 | public: | |
46 | virtual void registerTypes(const char *uri) |
|
46 | virtual void registerTypes(const char *uri) | |
47 | { |
|
47 | { | |
48 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); |
|
48 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); | |
49 |
|
49 | |||
50 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); |
|
50 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); | |
51 | qmlRegisterType<DeclarativeXyPoint>(uri, 1, 0, "XyPoint"); |
|
51 | qmlRegisterType<DeclarativeXyPoint>(uri, 1, 0, "XyPoint"); | |
52 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); |
|
52 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); | |
53 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
|
53 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); | |
54 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); |
|
54 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); | |
55 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); |
|
55 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); | |
56 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); |
|
56 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); | |
57 | qmlRegisterType<DeclarativeGroupedBarSeries>(uri, 1, 0, "GroupedBarSeries"); |
|
57 | qmlRegisterType<DeclarativeGroupedBarSeries>(uri, 1, 0, "GroupedBarSeries"); | |
58 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); |
|
58 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); | |
59 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); |
|
59 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); | |
60 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
|
60 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); | |
61 | qmlRegisterType<DeclarativePieSlice>(uri, 1, 0, "PieSlice"); |
|
61 | qmlRegisterType<DeclarativePieSlice>(uri, 1, 0, "PieSlice"); | |
62 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); |
|
62 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); | |
63 | qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper"); |
|
63 | qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper"); | |
64 | qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper"); |
|
64 | qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper"); | |
65 | qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); |
|
65 | qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); | |
66 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); |
|
66 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); | |
67 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); |
|
67 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); | |
68 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); |
|
68 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); | |
69 |
|
69 | |||
70 |
|
||||
71 | qmlRegisterUncreatableType<QScatterSeries>(uri, 1, 0, "QScatterSeries", |
|
70 | qmlRegisterUncreatableType<QScatterSeries>(uri, 1, 0, "QScatterSeries", | |
72 | QLatin1String("Trying to create uncreatable: QScatterSeries.")); |
|
71 | QLatin1String("Trying to create uncreatable: QScatterSeries.")); | |
73 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", |
|
72 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", | |
74 | QLatin1String("Trying to create uncreatable: QPieSeries.")); |
|
73 | QLatin1String("Trying to create uncreatable: QPieSeries.")); | |
|
74 | qmlRegisterUncreatableType<QPieSlice>(uri, 1, 0, "QPieSlice", | |||
|
75 | QLatin1String("Trying to create uncreatable: QPieSlice.")); | |||
75 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", |
|
76 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", | |
76 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
77 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); | |
77 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", |
|
78 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", | |
78 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
79 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); | |
79 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", |
|
80 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", | |
80 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
81 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); | |
81 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper", |
|
82 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper", | |
82 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
83 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); | |
83 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", |
|
84 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", | |
84 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
85 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); | |
85 | qmlRegisterUncreatableType<QAxis>(uri, 1, 0, "Axis", |
|
86 | qmlRegisterUncreatableType<QAxis>(uri, 1, 0, "Axis", | |
86 | QLatin1String("Trying to create uncreatable: Axis.")); |
|
87 | QLatin1String("Trying to create uncreatable: Axis.")); | |
87 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", |
|
88 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", | |
88 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
89 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); | |
89 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", |
|
90 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", | |
90 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
91 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); | |
91 | } |
|
92 | } | |
92 | }; |
|
93 | }; | |
93 |
|
94 | |||
94 | #include "plugin.moc" |
|
95 | #include "plugin.moc" | |
95 |
|
96 | |||
96 | QTCOMMERCIALCHART_END_NAMESPACE |
|
97 | QTCOMMERCIALCHART_END_NAMESPACE | |
97 |
|
98 | |||
98 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
99 | QTCOMMERCIALCHART_USE_NAMESPACE | |
99 |
|
100 | |||
100 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) |
|
101 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) |
General Comments 0
You need to be logged in to leave comments.
Login now