##// END OF EJS Templates
Improved usability of QML pie tester
Tero Ahola -
r1868:0ad2e4ec916e
parent child
Show More
@@ -19,17 +19,66
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;
@@ -74,69 +123,99 Row {
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;
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 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;
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 {
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