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