##// 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 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24
25 25 Flow {
26 26 id: flow
27 27 spacing: 5
28 28 flow: Flow.TopToBottom
29 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 45 Button {
32 46 text: "visible"
33 47 onClicked: series.visible = !series.visible;
34 48 }
35 49 Button {
36 50 text: "color"
37 51 onClicked: series.color = main.nextColor();
38 52 }
39 53 Button {
40 54 text: "borderColor"
41 55 onClicked: series.borderColor = main.nextColor();
42 56 }
43 57 Button {
44 58 text: "upper color"
45 59 onClicked: series.upperSeries.color = main.nextColor();
46 60 }
47 61 Button {
48 62 text: "lower color"
49 63 onClicked: series.lowerSeries.color = main.nextColor();
50 64 }
51 65 Button {
52 66 text: "upper points visible"
53 67 onClicked: series.upperSeries.pointsVisible = !series.pointsVisible;
54 68 }
55 69 Button {
56 70 text: "lower points visible"
57 71 onClicked: series.lowerSeries.pointsVisible = !series.pointsVisible;
58 72 }
59 73 }
@@ -1,66 +1,89
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24 Flow {
25 25 id: flow
26 26 spacing: 5
27 27 flow: Flow.TopToBottom
28 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 53 Button {
31 54 text: "visible"
32 55 onClicked: series.visible = !series.visible;
33 56 }
34 57 Button {
35 58 text: "labels visible"
36 59 onClicked: series.labelsVisible = !series.labelsVisible;
37 60 }
38 61 Button {
39 62 text: "bar margin +"
40 63 onClicked: series.barMargin += 0.1;
41 64 }
42 65 Button {
43 66 text: "bar margin -"
44 67 onClicked: series.barMargin -= 0.1;
45 68 }
46 69 Button {
47 70 text: "set 1 color"
48 71 onClicked: series.at(0).color = main.nextColor();
49 72 }
50 73 Button {
51 74 text: "set 1 border color"
52 75 onClicked: series.at(0).borderColor = main.nextColor();
53 76 }
54 77 Button {
55 78 text: "set 1 label color"
56 79 onClicked: series.at(0).labelColor = main.nextColor();
57 80 }
58 81 Button {
59 82 text: "set 1 font size +"
60 83 onClicked: series.at(0).labelFont.pixelSize += 1;
61 84 }
62 85 Button {
63 86 text: "set 1 font size -"
64 87 onClicked: series.at(0).labelFont.pixelSize -= 1;
65 88 }
66 89 }
@@ -1,69 +1,69
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22
23 23 Rectangle {
24 24 id: button
25 25 height: 25
26 26 width: 140
27 27 color: "#afafaf"
28 28 radius: 5
29 29
30 30 property string text: "button"
31 31 signal clicked
32 32
33 33 Text {
34 34 id: buttonText
35 35 anchors.centerIn: parent
36 36 text: button.text
37 37 }
38 38
39 39 MouseArea {
40 40 anchors.fill: parent
41 41 onClicked: {
42 42 button.clicked();
43 43 }
44 44 onPressedChanged: {
45 45 if (pressed) {
46 46 button.color = "#efefef";
47 47 } else {
48 48 button.color = "#afafaf";
49 49 }
50 50 }
51 51 onPressAndHold: {
52 52 repeatTimer.start();
53 53 }
54 54 onReleased: {
55 55 repeatTimer.stop();
56 56 }
57 57 }
58 58
59 59 Timer {
60 60 id: repeatTimer
61 interval: 200
61 interval: 140
62 62 repeat: true
63 63 triggeredOnStart: false
64 64 running: false
65 65 onTriggered: {
66 66 button.clicked();
67 67 }
68 68 }
69 69 }
@@ -1,94 +1,101
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24
25 25 Flow {
26 26 id: flow
27 27 spacing: 5
28 28 flow: Flow.TopToBottom
29 29 property variant series // TODO: rename to chart
30 30
31 onSeriesChanged: {
32 legendConnections.target = series.legend
33 }
34
31 35 Connections {
32 36 target: series
37 ignoreUnknownSignals: true
33 38 onVisibleChanged: console.log("chart.onVisibleChanged: " + series.visible);
34 39 onThemeChanged: console.log("chart.onThemeChanged: " + series.theme);
35 40 onLegendChanged: console.log("chart.onLegendChanged: " + series.legend);
36 41 onAnimationOptionsChanged: console.log("chart.onAnimationOptionsChanged: " + series.animationOptions);
37 42 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + series.titleColor);
38 43 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + series.backgroundColor);
39 44 }
45
40 46 Connections {
41 target: series.legend
47 id: legendConnections
48 ignoreUnknownSignals: true
42 49 onAlignmentChanged: console.log("legend.onAlignmentChanged: " + series.legend.alignment);
43 50 onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
44 51 }
45 52
46 53 Button {
47 54 text: "visible"
48 55 onClicked: series.visible = !series.visible;
49 56 }
50 57 Button {
51 58 text: "theme +"
52 59 onClicked: series.theme++;
53 60 }
54 61 Button {
55 62 text: "theme -"
56 63 onClicked: series.theme--;
57 64 }
58 65 Button {
59 66 text: "legend top"
60 67 onClicked: series.legend.alignment ^= Qt.AlignTop;
61 68 }
62 69 Button {
63 70 text: "legend bottom"
64 71 onClicked: series.legend.alignment ^= Qt.AlignBottom;
65 72 }
66 73 Button {
67 74 text: "legend left"
68 75 onClicked: series.legend.alignment ^= Qt.AlignLeft;
69 76 }
70 77 Button {
71 78 text: "legend right"
72 79 onClicked: series.legend.alignment ^= Qt.AlignRight;
73 80 }
74 81 Button {
75 82 text: "legend visible"
76 83 onClicked: series.legend.visible = !series.legend.visible;
77 84 }
78 85 Button {
79 86 text: "animation opt +"
80 87 onClicked: series.animationOptions++;
81 88 }
82 89 Button {
83 90 text: "animation opt -"
84 91 onClicked: series.animationOptions--;
85 92 }
86 93 Button {
87 94 text: "title color"
88 95 onClicked: series.titleColor = main.nextColor();
89 96 }
90 97 Button {
91 98 text: "background color"
92 99 onClicked: series.backgroundColor = main.nextColor();
93 100 }
94 101 }
@@ -1,43 +1,57
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24
25 25 Flow {
26 26 id: flow
27 27 spacing: 5
28 28 flow: Flow.TopToBottom
29 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 45 Button {
32 46 text: "visible"
33 47 onClicked: series.visible = !series.visible;
34 48 }
35 49 Button {
36 50 text: "color"
37 51 onClicked: series.color = main.nextColor();
38 52 }
39 53 Button {
40 54 text: "points visible"
41 55 onClicked: series.pointsVisible = !series.pointsVisible
42 56 }
43 57 }
@@ -1,118 +1,157
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24 Flow {
25 25 id: flow
26 26 spacing: 5
27 27 flow: Flow.TopToBottom
28 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 69 Button {
31 70 text: "visible"
32 71 onClicked: series.visible = !series.visible;
33 72 }
34 73 Button {
35 74 text: "series hpos +"
36 75 onClicked: series.horizontalPosition += 0.1;
37 76 }
38 77 Button {
39 78 text: "series hpos -"
40 79 onClicked: series.horizontalPosition -= 0.1;
41 80 }
42 81 Button {
43 82 text: "series vpos +"
44 83 onClicked: series.verticalPosition += 0.1;
45 84 }
46 85 Button {
47 86 text: "series vpos -"
48 87 onClicked: series.verticalPosition -= 0.1;
49 88 }
50 89 Button {
51 90 text: "series size +"
52 91 onClicked: series.size += 0.1;
53 92 }
54 93 Button {
55 94 text: "series size -"
56 95 onClicked: series.size -= 0.1;
57 96 }
58 97 Button {
59 98 text: "series start angle +"
60 onClicked: series.startAngle += 0.1;
99 onClicked: series.startAngle += 1.1;
61 100 }
62 101 Button {
63 102 text: "series start angle -"
64 onClicked: series.startAngle -= 0.1;
103 onClicked: series.startAngle -= 1.1;
65 104 }
66 105 Button {
67 106 text: "series end angle +"
68 onClicked: series.endAngle += 0.1;
107 onClicked: series.endAngle += 1.1;
69 108 }
70 109 Button {
71 110 text: "series end angle -"
72 onClicked: series.endAngle -= 0.1;
111 onClicked: series.endAngle -= 1.1;
73 112 }
74 113 Button {
75 114 text: "slice color"
76 115 onClicked: series.at(0).color = main.nextColor();
77 116 }
78 117 Button {
79 118 text: "slice border color"
80 119 onClicked: series.at(0).borderColor = main.nextColor();
81 120 }
82 121 Button {
83 122 text: "slice border width +"
84 123 onClicked: series.at(0).borderWidth++;
85 124 }
86 125 Button {
87 126 text: "slice border width -"
88 127 onClicked: series.at(0).borderWidth--;
89 128 }
90 129 Button {
91 130 text: "slice label visible"
92 131 onClicked: series.at(0).labelVisible = !series.at(0).labelVisible;
93 132 }
94 133 Button {
95 134 text: "slice label arm len +"
96 135 onClicked: series.at(0).labelArmLengthFactor += 0.1;
97 136 }
98 137 Button {
99 138 text: "slice label arm len -"
100 139 onClicked: series.at(0).labelArmLengthFactor -= 0.1;
101 140 }
102 141 Button {
103 142 text: "slice label color"
104 143 onClicked: series.at(0).labelColor = main.nextColor();
105 144 }
106 145 Button {
107 146 text: "slice exploded"
108 147 onClicked: series.at(0).exploded = !series.at(0).exploded;
109 148 }
110 149 Button {
111 150 text: "slice explode dist +"
112 151 onClicked: series.at(0).explodeDistanceFactor += 0.1;
113 152 }
114 153 Button {
115 154 text: "slice explode dist -"
116 155 onClicked: series.at(0).explodeDistanceFactor -= 0.1;
117 156 }
118 157 }
@@ -1,55 +1,72
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24
25 25 Flow {
26 26 id: flow
27 27 spacing: 5
28 28 flow: Flow.TopToBottom
29 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 48 Button {
32 49 text: "visible"
33 50 onClicked: series.visible = !series.visible;
34 51 }
35 52 Button {
36 53 text: "color"
37 54 onClicked: series.color = main.nextColor();
38 55 }
39 56 Button {
40 57 text: "borderColor"
41 58 onClicked: series.borderColor = main.nextColor();
42 59 }
43 60 Button {
44 61 text: "markerSize +"
45 62 onClicked: series.markerSize += 1.0;
46 63 }
47 64 Button {
48 65 text: "markerSize -"
49 66 onClicked: series.markerSize -= 1.0;
50 67 }
51 68 Button {
52 69 text: "markerShape"
53 70 onClicked: series.markerShape = ((series.markerShape + 1) % 2);
54 71 }
55 72 }
@@ -1,128 +1,126
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24 Rectangle {
25 25 id: main
26 26 width: parent.width
27 27 height: parent.height
28 28 property int viewNumber: 0
29 29 property int viewCount: 10
30 30 property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"]
31 31 property int colorIndex: 0
32 32
33 33 function nextColor() {
34 34 colorIndex++;
35 35 console.log("color: " + colors[colorIndex % colors.length]);
36 36 return colors[colorIndex % colors.length];
37 37 }
38 38
39 39 onViewNumberChanged: {
40 40 if (viewNumber == 0) {
41 41 chartLoader.source = "Chart.qml";
42 42 editorLoader.source = "ChartEditor.qml";
43 43 } else if (viewNumber == 1) {
44 44 chartLoader.source = "PieChart.qml";
45 45 editorLoader.source = "PieEditor.qml";
46 46 } else if (viewNumber == 2) {
47 47 chartLoader.source = "LineChart.qml";
48 48 editorLoader.source = "LineEditor.qml";
49 49 } else if (viewNumber == 3) {
50 50 chartLoader.source = "SplineChart.qml";
51 51 editorLoader.source = "LineEditor.qml";
52 52 } else if (viewNumber == 4) {
53 53 chartLoader.source = "ScatterChart.qml";
54 54 editorLoader.source = "ScatterEditor.qml";
55 55 } else if (viewNumber == 5) {
56 56 chartLoader.source = "AreaChart.qml";
57 57 editorLoader.source = "AreaEditor.qml";
58 58 } else if (viewNumber == 6) {
59 59 chartLoader.source = "BarChart.qml";
60 60 editorLoader.source = "BarEditor.qml";
61 61 } else if (viewNumber == 7) {
62 62 chartLoader.source = "GroupedBarChart.qml";
63 63 editorLoader.source = "BarEditor.qml";
64 64 } else if (viewNumber == 8) {
65 65 chartLoader.source = "StackedBarChart.qml";
66 66 editorLoader.source = "BarEditor.qml";
67 67 } else if (viewNumber == 9) {
68 68 chartLoader.source = "PercentBarChart.qml";
69 69 editorLoader.source = "BarEditor.qml";
70 70 } else {
71 71 console.log("Illegal view number");
72 72 }
73 73 }
74 74
75 75 Row {
76 76 anchors.top: parent.top
77 77 anchors.bottom: buttonRow.top
78 78 anchors.bottomMargin: 10
79 79 anchors.left: parent.left
80 80 anchors.right: parent.right
81 81
82 82 Loader {
83 83 id: chartLoader
84 84 width: main.width - editorLoader.width
85 85 height: parent.height
86 86 source: "Chart.qml"
87 87 onStatusChanged: {
88 console.log("chartLoader.status: " + status + " " + source);
89 if (status == Loader.Ready && editorLoader.status == Loader.Ready)
88 if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item)
90 89 editorLoader.item.series = chartLoader.item.series;
91 90 }
92 91 }
93 92
94 93 Loader {
95 94 id: editorLoader
96 95 width: 280
97 96 height: parent.height
98 97 source: "ChartEditor.qml"
99 98 onStatusChanged: {
100 console.log("editorLoader.status: " + status + " " + source);
101 if (status == Loader.Ready && chartLoader.status == Loader.Ready)
99 if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item)
102 100 editorLoader.item.series = chartLoader.item.series;
103 101 }
104 102 }
105 103 }
106 104
107 105 Row {
108 106 id: buttonRow
109 107 height: 40
110 108 anchors.bottom: parent.bottom
111 109 anchors.horizontalCenter: parent.horizontalCenter
112 110 spacing: 10
113 111
114 112 Button {
115 113 text: "previous"
116 114 onClicked: {
117 115 viewNumber = (viewNumber + viewCount - 1) % viewCount;
118 116 }
119 117 }
120 118
121 119 Button {
122 120 text: "next"
123 121 onClicked: {
124 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