##// END OF EJS Templates
Added logging for signals in qml property tester
Tero Ahola -
r1383:955f59270da8
parent child
Show More
@@ -1,59 +1,73
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
24
25 Flow {
25 Flow {
26 id: flow
26 id: flow
27 spacing: 5
27 spacing: 5
28 flow: Flow.TopToBottom
28 flow: Flow.TopToBottom
29 property variant series
29 property variant series
30
30
31 onSeriesChanged: {
32 seriesConnections.target = series;
33 }
34
35 Connections {
36 id: seriesConnections
37 ignoreUnknownSignals: true
38 onNameChanged: console.log("series.onNameChanged: " + series.name);
39 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
40 onColorChanged: console.log("series.onColorChanged: " + series.color);
41 onBorderColorChanged: console.log("series.onBorderColorChanged: " + series.borderColor);
42 onCountChanged: console.log("series.onCountChanged: " + series.count);
43 }
44
31 Button {
45 Button {
32 text: "visible"
46 text: "visible"
33 onClicked: series.visible = !series.visible;
47 onClicked: series.visible = !series.visible;
34 }
48 }
35 Button {
49 Button {
36 text: "color"
50 text: "color"
37 onClicked: series.color = main.nextColor();
51 onClicked: series.color = main.nextColor();
38 }
52 }
39 Button {
53 Button {
40 text: "borderColor"
54 text: "borderColor"
41 onClicked: series.borderColor = main.nextColor();
55 onClicked: series.borderColor = main.nextColor();
42 }
56 }
43 Button {
57 Button {
44 text: "upper color"
58 text: "upper color"
45 onClicked: series.upperSeries.color = main.nextColor();
59 onClicked: series.upperSeries.color = main.nextColor();
46 }
60 }
47 Button {
61 Button {
48 text: "lower color"
62 text: "lower color"
49 onClicked: series.lowerSeries.color = main.nextColor();
63 onClicked: series.lowerSeries.color = main.nextColor();
50 }
64 }
51 Button {
65 Button {
52 text: "upper points visible"
66 text: "upper points visible"
53 onClicked: series.upperSeries.pointsVisible = !series.pointsVisible;
67 onClicked: series.upperSeries.pointsVisible = !series.pointsVisible;
54 }
68 }
55 Button {
69 Button {
56 text: "lower points visible"
70 text: "lower points visible"
57 onClicked: series.lowerSeries.pointsVisible = !series.pointsVisible;
71 onClicked: series.lowerSeries.pointsVisible = !series.pointsVisible;
58 }
72 }
59 }
73 }
@@ -1,66 +1,89
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 Flow {
24 Flow {
25 id: flow
25 id: flow
26 spacing: 5
26 spacing: 5
27 flow: Flow.TopToBottom
27 flow: Flow.TopToBottom
28 property variant series
28 property variant series
29
29
30 onSeriesChanged: {
31 seriesConnections.target = series;
32 setConnections.target = series.at(0);
33 }
34
35 Connections {
36 id: seriesConnections
37 ignoreUnknownSignals: true
38 onNameChanged: console.log("series.onNameChanged: " + series.name);
39 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
40 onLabelsVisibleChanged: console.log("series.onLabelsVisibleChanged: " + series.labelsVisible);
41 onCountChanged: console.log("series.onCountChanged: " + series.count);
42 }
43
44 Connections {
45 id: setConnections
46 ignoreUnknownSignals: true
47 onColorChanged: console.log("series.onColorChanged: " + series.color);
48 onBorderColorChanged: console.log("series.onBorderColorChanged: " + series.borderColor);
49 onLabelColorChanged: console.log("series.onLabelColorChanged: " + series.labelColor);
50 onCountChanged: console.log("series.onCountChanged: " + series.count);
51 }
52
30 Button {
53 Button {
31 text: "visible"
54 text: "visible"
32 onClicked: series.visible = !series.visible;
55 onClicked: series.visible = !series.visible;
33 }
56 }
34 Button {
57 Button {
35 text: "labels visible"
58 text: "labels visible"
36 onClicked: series.labelsVisible = !series.labelsVisible;
59 onClicked: series.labelsVisible = !series.labelsVisible;
37 }
60 }
38 Button {
61 Button {
39 text: "bar margin +"
62 text: "bar margin +"
40 onClicked: series.barMargin += 0.1;
63 onClicked: series.barMargin += 0.1;
41 }
64 }
42 Button {
65 Button {
43 text: "bar margin -"
66 text: "bar margin -"
44 onClicked: series.barMargin -= 0.1;
67 onClicked: series.barMargin -= 0.1;
45 }
68 }
46 Button {
69 Button {
47 text: "set 1 color"
70 text: "set 1 color"
48 onClicked: series.at(0).color = main.nextColor();
71 onClicked: series.at(0).color = main.nextColor();
49 }
72 }
50 Button {
73 Button {
51 text: "set 1 border color"
74 text: "set 1 border color"
52 onClicked: series.at(0).borderColor = main.nextColor();
75 onClicked: series.at(0).borderColor = main.nextColor();
53 }
76 }
54 Button {
77 Button {
55 text: "set 1 label color"
78 text: "set 1 label color"
56 onClicked: series.at(0).labelColor = main.nextColor();
79 onClicked: series.at(0).labelColor = main.nextColor();
57 }
80 }
58 Button {
81 Button {
59 text: "set 1 font size +"
82 text: "set 1 font size +"
60 onClicked: series.at(0).labelFont.pixelSize += 1;
83 onClicked: series.at(0).labelFont.pixelSize += 1;
61 }
84 }
62 Button {
85 Button {
63 text: "set 1 font size -"
86 text: "set 1 font size -"
64 onClicked: series.at(0).labelFont.pixelSize -= 1;
87 onClicked: series.at(0).labelFont.pixelSize -= 1;
65 }
88 }
66 }
89 }
@@ -1,69 +1,69
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
22
23 Rectangle {
23 Rectangle {
24 id: button
24 id: button
25 height: 25
25 height: 25
26 width: 140
26 width: 140
27 color: "#afafaf"
27 color: "#afafaf"
28 radius: 5
28 radius: 5
29
29
30 property string text: "button"
30 property string text: "button"
31 signal clicked
31 signal clicked
32
32
33 Text {
33 Text {
34 id: buttonText
34 id: buttonText
35 anchors.centerIn: parent
35 anchors.centerIn: parent
36 text: button.text
36 text: button.text
37 }
37 }
38
38
39 MouseArea {
39 MouseArea {
40 anchors.fill: parent
40 anchors.fill: parent
41 onClicked: {
41 onClicked: {
42 button.clicked();
42 button.clicked();
43 }
43 }
44 onPressedChanged: {
44 onPressedChanged: {
45 if (pressed) {
45 if (pressed) {
46 button.color = "#efefef";
46 button.color = "#efefef";
47 } else {
47 } else {
48 button.color = "#afafaf";
48 button.color = "#afafaf";
49 }
49 }
50 }
50 }
51 onPressAndHold: {
51 onPressAndHold: {
52 repeatTimer.start();
52 repeatTimer.start();
53 }
53 }
54 onReleased: {
54 onReleased: {
55 repeatTimer.stop();
55 repeatTimer.stop();
56 }
56 }
57 }
57 }
58
58
59 Timer {
59 Timer {
60 id: repeatTimer
60 id: repeatTimer
61 interval: 200
61 interval: 140
62 repeat: true
62 repeat: true
63 triggeredOnStart: false
63 triggeredOnStart: false
64 running: false
64 running: false
65 onTriggered: {
65 onTriggered: {
66 button.clicked();
66 button.clicked();
67 }
67 }
68 }
68 }
69 }
69 }
@@ -1,94 +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 import QtQuick 1.0
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
22 import QtCommercial.Chart 1.0
23
23
24
24
25 Flow {
25 Flow {
26 id: flow
26 id: flow
27 spacing: 5
27 spacing: 5
28 flow: Flow.TopToBottom
28 flow: Flow.TopToBottom
29 property variant series // TODO: rename to chart
29 property variant series // TODO: rename to chart
30
30
31 onSeriesChanged: {
32 legendConnections.target = series.legend
33 }
34
31 Connections {
35 Connections {
32 target: series
36 target: series
37 ignoreUnknownSignals: true
33 onVisibleChanged: console.log("chart.onVisibleChanged: " + series.visible);
38 onVisibleChanged: console.log("chart.onVisibleChanged: " + series.visible);
34 onThemeChanged: console.log("chart.onThemeChanged: " + series.theme);
39 onThemeChanged: console.log("chart.onThemeChanged: " + series.theme);
35 onLegendChanged: console.log("chart.onLegendChanged: " + series.legend);
40 onLegendChanged: console.log("chart.onLegendChanged: " + series.legend);
36 onAnimationOptionsChanged: console.log("chart.onAnimationOptionsChanged: " + series.animationOptions);
41 onAnimationOptionsChanged: console.log("chart.onAnimationOptionsChanged: " + series.animationOptions);
37 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + series.titleColor);
42 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + series.titleColor);
38 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + series.backgroundColor);
43 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + series.backgroundColor);
39 }
44 }
45
40 Connections {
46 Connections {
41 target: series.legend
47 id: legendConnections
48 ignoreUnknownSignals: true
42 onAlignmentChanged: console.log("legend.onAlignmentChanged: " + series.legend.alignment);
49 onAlignmentChanged: console.log("legend.onAlignmentChanged: " + series.legend.alignment);
43 onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
50 onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
44 }
51 }
45
52
46 Button {
53 Button {
47 text: "visible"
54 text: "visible"
48 onClicked: series.visible = !series.visible;
55 onClicked: series.visible = !series.visible;
49 }
56 }
50 Button {
57 Button {
51 text: "theme +"
58 text: "theme +"
52 onClicked: series.theme++;
59 onClicked: series.theme++;
53 }
60 }
54 Button {
61 Button {
55 text: "theme -"
62 text: "theme -"
56 onClicked: series.theme--;
63 onClicked: series.theme--;
57 }
64 }
58 Button {
65 Button {
59 text: "legend top"
66 text: "legend top"
60 onClicked: series.legend.alignment ^= Qt.AlignTop;
67 onClicked: series.legend.alignment ^= Qt.AlignTop;
61 }
68 }
62 Button {
69 Button {
63 text: "legend bottom"
70 text: "legend bottom"
64 onClicked: series.legend.alignment ^= Qt.AlignBottom;
71 onClicked: series.legend.alignment ^= Qt.AlignBottom;
65 }
72 }
66 Button {
73 Button {
67 text: "legend left"
74 text: "legend left"
68 onClicked: series.legend.alignment ^= Qt.AlignLeft;
75 onClicked: series.legend.alignment ^= Qt.AlignLeft;
69 }
76 }
70 Button {
77 Button {
71 text: "legend right"
78 text: "legend right"
72 onClicked: series.legend.alignment ^= Qt.AlignRight;
79 onClicked: series.legend.alignment ^= Qt.AlignRight;
73 }
80 }
74 Button {
81 Button {
75 text: "legend visible"
82 text: "legend visible"
76 onClicked: series.legend.visible = !series.legend.visible;
83 onClicked: series.legend.visible = !series.legend.visible;
77 }
84 }
78 Button {
85 Button {
79 text: "animation opt +"
86 text: "animation opt +"
80 onClicked: series.animationOptions++;
87 onClicked: series.animationOptions++;
81 }
88 }
82 Button {
89 Button {
83 text: "animation opt -"
90 text: "animation opt -"
84 onClicked: series.animationOptions--;
91 onClicked: series.animationOptions--;
85 }
92 }
86 Button {
93 Button {
87 text: "title color"
94 text: "title color"
88 onClicked: series.titleColor = main.nextColor();
95 onClicked: series.titleColor = main.nextColor();
89 }
96 }
90 Button {
97 Button {
91 text: "background color"
98 text: "background color"
92 onClicked: series.backgroundColor = main.nextColor();
99 onClicked: series.backgroundColor = main.nextColor();
93 }
100 }
94 }
101 }
@@ -1,43 +1,57
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
24
25 Flow {
25 Flow {
26 id: flow
26 id: flow
27 spacing: 5
27 spacing: 5
28 flow: Flow.TopToBottom
28 flow: Flow.TopToBottom
29 property variant series
29 property variant series
30
30
31 onSeriesChanged: {
32 seriesConnections.target = series;
33 }
34
35 Connections {
36 id: seriesConnections
37 ignoreUnknownSignals: true
38 onNameChanged: console.log("series.onNameChanged: " + series.name);
39 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
40 onPointsVisibleChanged: console.log("series.onPointsVisibleChanged: " + series.pointsVisible);
41 onColorChanged: console.log("series.onColorChanged: " + series.color);
42 onCountChanged: console.log("series.onCountChanged: " + series.count);
43 }
44
31 Button {
45 Button {
32 text: "visible"
46 text: "visible"
33 onClicked: series.visible = !series.visible;
47 onClicked: series.visible = !series.visible;
34 }
48 }
35 Button {
49 Button {
36 text: "color"
50 text: "color"
37 onClicked: series.color = main.nextColor();
51 onClicked: series.color = main.nextColor();
38 }
52 }
39 Button {
53 Button {
40 text: "points visible"
54 text: "points visible"
41 onClicked: series.pointsVisible = !series.pointsVisible
55 onClicked: series.pointsVisible = !series.pointsVisible
42 }
56 }
43 }
57 }
@@ -1,118 +1,157
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 Flow {
24 Flow {
25 id: flow
25 id: flow
26 spacing: 5
26 spacing: 5
27 flow: Flow.TopToBottom
27 flow: Flow.TopToBottom
28 property variant series
28 property variant series
29
29
30 onSeriesChanged: {
31 seriesConnections.target = series;
32 sliceConnections.target = series.at(0);
33 }
34
35 Connections {
36 id: seriesConnections
37 ignoreUnknownSignals: true
38 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
39 onHorizontalPositionChanged:console.log("series.onHorizontalPositionChanged: " + series.horizontalPosition);
40 onVerticalPositionChanged: console.log("series.onVerticalPositionChanged: " + series.verticalPosition);
41 onSizeChanged: console.log("series.onSizeChanged: " + series.size);
42 onStartAngleChanged: console.log("series.onStartAngleChanged: " + series.startAngle);
43 onEndAngleChanged: console.log("series.onEndAngleChanged: " + series.endAngle);
44 onCountChanged: console.log("series.onCountChanged: " + series.count);
45 onSumChanged: console.log("series.onSumChanged: " + series.sum);
46 }
47
48 Connections {
49 id: sliceConnections
50 ignoreUnknownSignals: true
51 onValueChanged: console.log("slice.onValueChanged: " + series.at(0).value);
52 onLabelVisibleChanged: console.log("slice.onLabelVisibleChanged: " + series.at(0).labelVisible);
53 onExplodedChanged: console.log("slice.onExplodedChanged: " + series.at(0).exploded);
54 onPenChanged: console.log("slice.onPenChanged: " + series.at(0).pen);
55 onBorderColorChanged: console.log("slice.onBorderColorChanged: " + series.at(0).borderColor);
56 onBorderWidthChanged: console.log("slice.onBorderWidthChanged: " + series.at(0).borderWidth);
57 onBrushChanged: console.log("slice.onBrushChanged: " + series.at(0).brush);
58 onColorChanged: console.log("slice.onColorChanged: " + series.at(0).color);
59 onLabelColorChanged: console.log("slice.onLabelColorChanged: " + series.at(0).labelColor);
60 onLabelBrushChanged: console.log("slice.onLabelBrushChanged: " + series.at(0).labelBrush);
61 onLabelFontChanged: console.log("slice.onLabelFontChanged: " + series.at(0).labelFont);
62 onLabelArmLengthFactorChanged: console.log("slice.onLabelArmLengthFactorChanged: " + series.at(0).labelArmLengthFactor);
63 onExplodeDistanceFactorChanged: console.log("slice.onExplodeDistanceFactorChanged: " + series.at(0).explodeDistanceFactor);
64 onPercentageChanged: console.log("slice.onPercentageChanged: " + series.at(0).percentage);
65 onStartAngleChanged: console.log("slice.onStartAngleChanged: " + series.at(0).startAngle);
66 onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + series.at(0).angleSpan);
67 }
68
30 Button {
69 Button {
31 text: "visible"
70 text: "visible"
32 onClicked: series.visible = !series.visible;
71 onClicked: series.visible = !series.visible;
33 }
72 }
34 Button {
73 Button {
35 text: "series hpos +"
74 text: "series hpos +"
36 onClicked: series.horizontalPosition += 0.1;
75 onClicked: series.horizontalPosition += 0.1;
37 }
76 }
38 Button {
77 Button {
39 text: "series hpos -"
78 text: "series hpos -"
40 onClicked: series.horizontalPosition -= 0.1;
79 onClicked: series.horizontalPosition -= 0.1;
41 }
80 }
42 Button {
81 Button {
43 text: "series vpos +"
82 text: "series vpos +"
44 onClicked: series.verticalPosition += 0.1;
83 onClicked: series.verticalPosition += 0.1;
45 }
84 }
46 Button {
85 Button {
47 text: "series vpos -"
86 text: "series vpos -"
48 onClicked: series.verticalPosition -= 0.1;
87 onClicked: series.verticalPosition -= 0.1;
49 }
88 }
50 Button {
89 Button {
51 text: "series size +"
90 text: "series size +"
52 onClicked: series.size += 0.1;
91 onClicked: series.size += 0.1;
53 }
92 }
54 Button {
93 Button {
55 text: "series size -"
94 text: "series size -"
56 onClicked: series.size -= 0.1;
95 onClicked: series.size -= 0.1;
57 }
96 }
58 Button {
97 Button {
59 text: "series start angle +"
98 text: "series start angle +"
60 onClicked: series.startAngle += 0.1;
99 onClicked: series.startAngle += 1.1;
61 }
100 }
62 Button {
101 Button {
63 text: "series start angle -"
102 text: "series start angle -"
64 onClicked: series.startAngle -= 0.1;
103 onClicked: series.startAngle -= 1.1;
65 }
104 }
66 Button {
105 Button {
67 text: "series end angle +"
106 text: "series end angle +"
68 onClicked: series.endAngle += 0.1;
107 onClicked: series.endAngle += 1.1;
69 }
108 }
70 Button {
109 Button {
71 text: "series end angle -"
110 text: "series end angle -"
72 onClicked: series.endAngle -= 0.1;
111 onClicked: series.endAngle -= 1.1;
73 }
112 }
74 Button {
113 Button {
75 text: "slice color"
114 text: "slice color"
76 onClicked: series.at(0).color = main.nextColor();
115 onClicked: series.at(0).color = main.nextColor();
77 }
116 }
78 Button {
117 Button {
79 text: "slice border color"
118 text: "slice border color"
80 onClicked: series.at(0).borderColor = main.nextColor();
119 onClicked: series.at(0).borderColor = main.nextColor();
81 }
120 }
82 Button {
121 Button {
83 text: "slice border width +"
122 text: "slice border width +"
84 onClicked: series.at(0).borderWidth++;
123 onClicked: series.at(0).borderWidth++;
85 }
124 }
86 Button {
125 Button {
87 text: "slice border width -"
126 text: "slice border width -"
88 onClicked: series.at(0).borderWidth--;
127 onClicked: series.at(0).borderWidth--;
89 }
128 }
90 Button {
129 Button {
91 text: "slice label visible"
130 text: "slice label visible"
92 onClicked: series.at(0).labelVisible = !series.at(0).labelVisible;
131 onClicked: series.at(0).labelVisible = !series.at(0).labelVisible;
93 }
132 }
94 Button {
133 Button {
95 text: "slice label arm len +"
134 text: "slice label arm len +"
96 onClicked: series.at(0).labelArmLengthFactor += 0.1;
135 onClicked: series.at(0).labelArmLengthFactor += 0.1;
97 }
136 }
98 Button {
137 Button {
99 text: "slice label arm len -"
138 text: "slice label arm len -"
100 onClicked: series.at(0).labelArmLengthFactor -= 0.1;
139 onClicked: series.at(0).labelArmLengthFactor -= 0.1;
101 }
140 }
102 Button {
141 Button {
103 text: "slice label color"
142 text: "slice label color"
104 onClicked: series.at(0).labelColor = main.nextColor();
143 onClicked: series.at(0).labelColor = main.nextColor();
105 }
144 }
106 Button {
145 Button {
107 text: "slice exploded"
146 text: "slice exploded"
108 onClicked: series.at(0).exploded = !series.at(0).exploded;
147 onClicked: series.at(0).exploded = !series.at(0).exploded;
109 }
148 }
110 Button {
149 Button {
111 text: "slice explode dist +"
150 text: "slice explode dist +"
112 onClicked: series.at(0).explodeDistanceFactor += 0.1;
151 onClicked: series.at(0).explodeDistanceFactor += 0.1;
113 }
152 }
114 Button {
153 Button {
115 text: "slice explode dist -"
154 text: "slice explode dist -"
116 onClicked: series.at(0).explodeDistanceFactor -= 0.1;
155 onClicked: series.at(0).explodeDistanceFactor -= 0.1;
117 }
156 }
118 }
157 }
@@ -1,55 +1,72
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
24
25 Flow {
25 Flow {
26 id: flow
26 id: flow
27 spacing: 5
27 spacing: 5
28 flow: Flow.TopToBottom
28 flow: Flow.TopToBottom
29 property variant series
29 property variant series
30
30
31 onSeriesChanged: {
32 seriesConnections.target = series;
33 }
34
35 Connections {
36 id: seriesConnections
37 ignoreUnknownSignals: true
38 onNameChanged: console.log("series.onNameChanged: " + series.name);
39 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
40 onPointsVisibleChanged: console.log("series.onPointsVisibleChanged: " + series.pointsVisible);
41 onColorChanged: console.log("series.onColorChanged: " + series.color);
42 onBorderColorChanged: console.log("series.onBorderColorChanged: " + series.borderColor);
43 onCountChanged: console.log("series.onCountChanged: " + series.count);
44 onMarkerSizeChanged: console.log("series.onMarkerSizeChanged: " + series.markerSize);
45 onMarkerShapeChanged: console.log("series.onMarkerShapeChanged: " + series.markerShape);
46 }
47
31 Button {
48 Button {
32 text: "visible"
49 text: "visible"
33 onClicked: series.visible = !series.visible;
50 onClicked: series.visible = !series.visible;
34 }
51 }
35 Button {
52 Button {
36 text: "color"
53 text: "color"
37 onClicked: series.color = main.nextColor();
54 onClicked: series.color = main.nextColor();
38 }
55 }
39 Button {
56 Button {
40 text: "borderColor"
57 text: "borderColor"
41 onClicked: series.borderColor = main.nextColor();
58 onClicked: series.borderColor = main.nextColor();
42 }
59 }
43 Button {
60 Button {
44 text: "markerSize +"
61 text: "markerSize +"
45 onClicked: series.markerSize += 1.0;
62 onClicked: series.markerSize += 1.0;
46 }
63 }
47 Button {
64 Button {
48 text: "markerSize -"
65 text: "markerSize -"
49 onClicked: series.markerSize -= 1.0;
66 onClicked: series.markerSize -= 1.0;
50 }
67 }
51 Button {
68 Button {
52 text: "markerShape"
69 text: "markerShape"
53 onClicked: series.markerShape = ((series.markerShape + 1) % 2);
70 onClicked: series.markerShape = ((series.markerShape + 1) % 2);
54 }
71 }
55 }
72 }
@@ -1,128 +1,126
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 id: main
25 id: main
26 width: parent.width
26 width: parent.width
27 height: parent.height
27 height: parent.height
28 property int viewNumber: 0
28 property int viewNumber: 0
29 property int viewCount: 10
29 property int viewCount: 10
30 property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"]
30 property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"]
31 property int colorIndex: 0
31 property int colorIndex: 0
32
32
33 function nextColor() {
33 function nextColor() {
34 colorIndex++;
34 colorIndex++;
35 console.log("color: " + colors[colorIndex % colors.length]);
35 console.log("color: " + colors[colorIndex % colors.length]);
36 return colors[colorIndex % colors.length];
36 return colors[colorIndex % colors.length];
37 }
37 }
38
38
39 onViewNumberChanged: {
39 onViewNumberChanged: {
40 if (viewNumber == 0) {
40 if (viewNumber == 0) {
41 chartLoader.source = "Chart.qml";
41 chartLoader.source = "Chart.qml";
42 editorLoader.source = "ChartEditor.qml";
42 editorLoader.source = "ChartEditor.qml";
43 } else if (viewNumber == 1) {
43 } else if (viewNumber == 1) {
44 chartLoader.source = "PieChart.qml";
44 chartLoader.source = "PieChart.qml";
45 editorLoader.source = "PieEditor.qml";
45 editorLoader.source = "PieEditor.qml";
46 } else if (viewNumber == 2) {
46 } else if (viewNumber == 2) {
47 chartLoader.source = "LineChart.qml";
47 chartLoader.source = "LineChart.qml";
48 editorLoader.source = "LineEditor.qml";
48 editorLoader.source = "LineEditor.qml";
49 } else if (viewNumber == 3) {
49 } else if (viewNumber == 3) {
50 chartLoader.source = "SplineChart.qml";
50 chartLoader.source = "SplineChart.qml";
51 editorLoader.source = "LineEditor.qml";
51 editorLoader.source = "LineEditor.qml";
52 } else if (viewNumber == 4) {
52 } else if (viewNumber == 4) {
53 chartLoader.source = "ScatterChart.qml";
53 chartLoader.source = "ScatterChart.qml";
54 editorLoader.source = "ScatterEditor.qml";
54 editorLoader.source = "ScatterEditor.qml";
55 } else if (viewNumber == 5) {
55 } else if (viewNumber == 5) {
56 chartLoader.source = "AreaChart.qml";
56 chartLoader.source = "AreaChart.qml";
57 editorLoader.source = "AreaEditor.qml";
57 editorLoader.source = "AreaEditor.qml";
58 } else if (viewNumber == 6) {
58 } else if (viewNumber == 6) {
59 chartLoader.source = "BarChart.qml";
59 chartLoader.source = "BarChart.qml";
60 editorLoader.source = "BarEditor.qml";
60 editorLoader.source = "BarEditor.qml";
61 } else if (viewNumber == 7) {
61 } else if (viewNumber == 7) {
62 chartLoader.source = "GroupedBarChart.qml";
62 chartLoader.source = "GroupedBarChart.qml";
63 editorLoader.source = "BarEditor.qml";
63 editorLoader.source = "BarEditor.qml";
64 } else if (viewNumber == 8) {
64 } else if (viewNumber == 8) {
65 chartLoader.source = "StackedBarChart.qml";
65 chartLoader.source = "StackedBarChart.qml";
66 editorLoader.source = "BarEditor.qml";
66 editorLoader.source = "BarEditor.qml";
67 } else if (viewNumber == 9) {
67 } else if (viewNumber == 9) {
68 chartLoader.source = "PercentBarChart.qml";
68 chartLoader.source = "PercentBarChart.qml";
69 editorLoader.source = "BarEditor.qml";
69 editorLoader.source = "BarEditor.qml";
70 } else {
70 } else {
71 console.log("Illegal view number");
71 console.log("Illegal view number");
72 }
72 }
73 }
73 }
74
74
75 Row {
75 Row {
76 anchors.top: parent.top
76 anchors.top: parent.top
77 anchors.bottom: buttonRow.top
77 anchors.bottom: buttonRow.top
78 anchors.bottomMargin: 10
78 anchors.bottomMargin: 10
79 anchors.left: parent.left
79 anchors.left: parent.left
80 anchors.right: parent.right
80 anchors.right: parent.right
81
81
82 Loader {
82 Loader {
83 id: chartLoader
83 id: chartLoader
84 width: main.width - editorLoader.width
84 width: main.width - editorLoader.width
85 height: parent.height
85 height: parent.height
86 source: "Chart.qml"
86 source: "Chart.qml"
87 onStatusChanged: {
87 onStatusChanged: {
88 console.log("chartLoader.status: " + status + " " + source);
88 if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item)
89 if (status == Loader.Ready && editorLoader.status == Loader.Ready)
90 editorLoader.item.series = chartLoader.item.series;
89 editorLoader.item.series = chartLoader.item.series;
91 }
90 }
92 }
91 }
93
92
94 Loader {
93 Loader {
95 id: editorLoader
94 id: editorLoader
96 width: 280
95 width: 280
97 height: parent.height
96 height: parent.height
98 source: "ChartEditor.qml"
97 source: "ChartEditor.qml"
99 onStatusChanged: {
98 onStatusChanged: {
100 console.log("editorLoader.status: " + status + " " + source);
99 if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item)
101 if (status == Loader.Ready && chartLoader.status == Loader.Ready)
102 editorLoader.item.series = chartLoader.item.series;
100 editorLoader.item.series = chartLoader.item.series;
103 }
101 }
104 }
102 }
105 }
103 }
106
104
107 Row {
105 Row {
108 id: buttonRow
106 id: buttonRow
109 height: 40
107 height: 40
110 anchors.bottom: parent.bottom
108 anchors.bottom: parent.bottom
111 anchors.horizontalCenter: parent.horizontalCenter
109 anchors.horizontalCenter: parent.horizontalCenter
112 spacing: 10
110 spacing: 10
113
111
114 Button {
112 Button {
115 text: "previous"
113 text: "previous"
116 onClicked: {
114 onClicked: {
117 viewNumber = (viewNumber + viewCount - 1) % viewCount;
115 viewNumber = (viewNumber + viewCount - 1) % viewCount;
118 }
116 }
119 }
117 }
120
118
121 Button {
119 Button {
122 text: "next"
120 text: "next"
123 onClicked: {
121 onClicked: {
124 viewNumber = (viewNumber + 1) % viewCount;
122 viewNumber = (viewNumber + 1) % viewCount;
125 }
123 }
126 }
124 }
127 }
125 }
128 }
126 }
General Comments 0
You need to be logged in to leave comments. Login now