##// END OF EJS Templates
Improved usability of QML pie tester
Tero Ahola -
r1868:0ad2e4ec916e
parent child
Show More
@@ -1,142 +1,221
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.1
22
23
23 Row {
24 Row {
24 anchors.fill: parent
25 anchors.fill: parent
25 spacing: 5
26 spacing: 5
26 property variant series
27 property variant series
28 property int sliceIndex: 0
27
29
30 // buttons for selecting the edited object: series, slice or label
28 Flow {
31 Flow {
29 id: flow
32 id: editorSelectorFlow
30 spacing: 5
33 spacing: 5
31 flow: Flow.TopToBottom
34 flow: Flow.TopToBottom
35 Button {
36 id: seriesButton
37 text: "series"
38 unpressedColor: "#79bd8f"
39 onClicked: {
40 seriesFlow.visible = true;
41 slicesFlow.visible = false;
42 labelsFlow.visible = false;
43 color = "#00a388";
44 sliceButton.color = "#79bd8f";
45 labelButton.color = "#79bd8f";
46 }
47 }
48 Button {
49 id: sliceButton
50 text: "slice"
51 unpressedColor: "#79bd8f"
52 onClicked: {
53 seriesFlow.visible = false;
54 slicesFlow.visible = true;
55 labelsFlow.visible = false;
56 color = "#00a388";
57 seriesButton.color = "#79bd8f";
58 labelButton.color = "#79bd8f";
59 }
60 }
61 Button {
62 id: labelButton
63 text: "label"
64 unpressedColor: "#79bd8f"
65 onClicked: {
66 seriesFlow.visible = false;
67 slicesFlow.visible = false;
68 labelsFlow.visible = true;
69 color = "#00a388";
70 seriesButton.color = "#79bd8f";
71 sliceButton.color = "#79bd8f";
72 }
73 }
74 }
32
75
76 // Buttons for editing series
77 Flow {
78 id: seriesFlow
79 spacing: 5
80 flow: Flow.TopToBottom
81 visible: false
33 Button {
82 Button {
34 text: "visible"
83 text: "visible"
35 onClicked: series.visible = !series.visible;
84 onClicked: series.visible = !series.visible;
36 }
85 }
37 Button {
86 Button {
38 text: "series hpos +"
87 text: "series hpos +"
39 onClicked: series.horizontalPosition += 0.1;
88 onClicked: series.horizontalPosition += 0.1;
40 }
89 }
41 Button {
90 Button {
42 text: "series hpos -"
91 text: "series hpos -"
43 onClicked: series.horizontalPosition -= 0.1;
92 onClicked: series.horizontalPosition -= 0.1;
44 }
93 }
45 Button {
94 Button {
46 text: "series vpos +"
95 text: "series vpos +"
47 onClicked: series.verticalPosition += 0.1;
96 onClicked: series.verticalPosition += 0.1;
48 }
97 }
49 Button {
98 Button {
50 text: "series vpos -"
99 text: "series vpos -"
51 onClicked: series.verticalPosition -= 0.1;
100 onClicked: series.verticalPosition -= 0.1;
52 }
101 }
53 Button {
102 Button {
54 text: "series size +"
103 text: "series size +"
55 onClicked: series.size += 0.1;
104 onClicked: series.size += 0.1;
56 }
105 }
57 Button {
106 Button {
58 text: "series size -"
107 text: "series size -"
59 onClicked: series.size -= 0.1;
108 onClicked: series.size -= 0.1;
60 }
109 }
61 Button {
110 Button {
62 text: "series start angle +"
111 text: "series start angle +"
63 onClicked: series.startAngle += 1.1;
112 onClicked: series.startAngle += 1.1;
64 }
113 }
65 Button {
114 Button {
66 text: "series start angle -"
115 text: "series start angle -"
67 onClicked: series.startAngle -= 1.1;
116 onClicked: series.startAngle -= 1.1;
68 }
117 }
69 Button {
118 Button {
70 text: "series end angle +"
119 text: "series end angle +"
71 onClicked: series.endAngle += 1.1;
120 onClicked: series.endAngle += 1.1;
72 }
121 }
73 Button {
122 Button {
74 text: "series end angle -"
123 text: "series end angle -"
75 onClicked: series.endAngle -= 1.1;
124 onClicked: series.endAngle -= 1.1;
76 }
125 }
126 }
127
128 // Buttons for editing slices
129 Flow {
130 id: slicesFlow
131 spacing: 5
132 flow: Flow.TopToBottom
133 visible: false
134
135 Button {
136 text: "append slice"
137 onClicked: series.append("slice" + (series.count + 1), 3.0);
138 }
77 Button {
139 Button {
78 text: "remove slice"
140 text: "remove slice"
79 onClicked: series.remove(series.at(series.count - 1));
141 onClicked: series.remove(series.at(series.count - 1));
80 }
142 }
81 Button {
143 Button {
82 text: "slice color"
144 text: "slice color"
83 onClicked: series.at(0).color = main.nextColor();
145 onClicked: series.at(sliceIndex).color = main.nextColor();
84 }
146 }
85 Button {
147 Button {
86 text: "slice border color"
148 text: "slice border color"
87 onClicked: series.at(0).borderColor = main.nextColor();
149 onClicked: series.at(sliceIndex).borderColor = main.nextColor();
88 }
150 }
89 Button {
151 Button {
90 text: "slice border width +"
152 text: "slice border width +"
91 onClicked: series.at(0).borderWidth++;
153 onClicked: series.at(sliceIndex).borderWidth++;
92 }
154 }
93 Button {
155 Button {
94 text: "slice border width -"
156 text: "slice border width -"
95 onClicked: series.at(0).borderWidth--;
157 onClicked: series.at(sliceIndex).borderWidth--;
96 }
158 }
97 Button {
159 Button {
98 text: "slice label visible"
160 text: "slice exploded"
99 onClicked: series.at(0).labelVisible = !series.at(0).labelVisible;
161 onClicked: series.at(sliceIndex).exploded = !series.at(sliceIndex).exploded;
100 }
162 }
101 Button {
163 Button {
102 text: "slice label position inside"
164 text: "slice explode dist +"
103 onClicked: series.at(0).labelPosition = PieSlice.LabelInside;
165 onClicked: series.at(sliceIndex).explodeDistanceFactor += 0.1;
104 }
166 }
105 Button {
167 Button {
106 text: "slice label position outside"
168 text: "slice explode dist -"
107 onClicked: series.at(0).labelPosition = PieSlice.LabelOutside;
169 onClicked: series.at(sliceIndex).explodeDistanceFactor -= 0.1;
170 }
108 }
171 }
172
173 // Buttons for editing labels
174 Flow {
175 id: labelsFlow
176 spacing: 5
177 flow: Flow.TopToBottom
178 visible: false
179
109 Button {
180 Button {
110 text: "slice label arm len +"
181 text: "label visible"
111 onClicked: series.at(0).labelArmLengthFactor += 0.1;
182 onClicked: series.at(sliceIndex).labelVisible = !series.at(sliceIndex).labelVisible;
112 }
183 }
113 Button {
184 Button {
114 text: "slice label arm len -"
185 text: "LabelInsideNormal"
115 onClicked: series.at(0).labelArmLengthFactor -= 0.1;
186 onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideNormal;
116 }
187 }
117 Button {
188 Button {
118 text: "slice label color"
189 text: "LabelInsideHorizontal"
119 onClicked: series.at(0).labelColor = main.nextColor();
190 onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideHorizontal;
120 }
191 }
121 Button {
192 Button {
122 text: "slice exploded"
193 text: "LabelInsideTangential"
123 onClicked: series.at(0).exploded = !series.at(0).exploded;
194 onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideTangential;
124 }
195 }
125 Button {
196 Button {
126 text: "slice explode dist +"
197 text: "LabelOutside"
127 onClicked: series.at(0).explodeDistanceFactor += 0.1;
198 onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelOutside;
128 }
199 }
129 Button {
200 Button {
130 text: "slice explode dist -"
201 text: "label arm len +"
131 onClicked: series.at(0).explodeDistanceFactor -= 0.1;
202 onClicked: series.at(sliceIndex).labelArmLengthFactor += 0.1;
132 }
203 }
204 Button {
205 text: "label arm len -"
206 onClicked: series.at(sliceIndex).labelArmLengthFactor -= 0.1;
207 }
208 Button {
209 text: "slice label color"
210 onClicked: series.at(sliceIndex).labelColor = main.nextColor();
133 }
211 }
134
212
135 FontEditor {
213 FontEditor {
136 id: fontEditor
214 id: fontEditor
137 fontDescription: "label"
215 fontDescription: "label"
138 function editedFont() {
216 function editedFont() {
139 return series.at(0).labelFont;
217 return series.at(sliceIndex).labelFont;
218 }
140 }
219 }
141 }
220 }
142 }
221 }
General Comments 0
You need to be logged in to leave comments. Login now