@@ -1,1039 +1,1039 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | #include <QtCharts/QAbstractAxis> |
|
19 | #include <QtCharts/QAbstractAxis> | |
20 | #include <private/qabstractaxis_p.h> |
|
20 | #include <private/qabstractaxis_p.h> | |
21 | #include <private/chartdataset_p.h> |
|
21 | #include <private/chartdataset_p.h> | |
22 | #include <private/charttheme_p.h> |
|
22 | #include <private/charttheme_p.h> | |
23 | #include <private/qchart_p.h> |
|
23 | #include <private/qchart_p.h> | |
24 |
|
24 | |||
25 | QT_CHARTS_BEGIN_NAMESPACE |
|
25 | QT_CHARTS_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | /*! |
|
27 | /*! | |
28 | \class QAbstractAxis |
|
28 | \class QAbstractAxis | |
29 | \inmodule Qt Charts |
|
29 | \inmodule Qt Charts | |
30 | \brief The QAbstractAxis class is used for manipulating chart's axis. |
|
30 | \brief The QAbstractAxis class is used for manipulating chart's axis. | |
31 |
|
31 | |||
32 | Each series can be bound to one or more horizontal and vertical axes, but mixing axis types |
|
32 | Each series can be bound to one or more horizontal and vertical axes, but mixing axis types | |
33 | that would result in different domains is not supported, such as specifying |
|
33 | that would result in different domains is not supported, such as specifying | |
34 | QValueAxis and QLogValueAxis on the same orientation. |
|
34 | QValueAxis and QLogValueAxis on the same orientation. | |
35 |
|
35 | |||
36 | Properties and visibility of various axis elements such as axis line, title, labels, grid lines, |
|
36 | Properties and visibility of various axis elements such as axis line, title, labels, grid lines, | |
37 | and shades can be individually controlled. |
|
37 | and shades can be individually controlled. | |
38 | */ |
|
38 | */ | |
39 | /*! |
|
39 | /*! | |
40 | \qmltype AbstractAxis |
|
40 | \qmltype AbstractAxis | |
41 | \instantiates QAbstractAxis |
|
41 | \instantiates QAbstractAxis | |
42 | \inqmlmodule QtCharts |
|
42 | \inqmlmodule QtCharts | |
43 |
|
43 | |||
44 | \brief The AbstractAxis is a base element used for specialized axis elements. |
|
44 | \brief The AbstractAxis is a base element used for specialized axis elements. | |
45 |
|
45 | |||
46 | Each series can be bound to only one horizontal and vertical axis. |
|
46 | Each series can be bound to only one horizontal and vertical axis. | |
47 |
|
47 | |||
48 | Properties and visibility of various axis elements such as axis line, title, labels, grid lines, |
|
48 | Properties and visibility of various axis elements such as axis line, title, labels, grid lines, | |
49 | and shades can be individually controlled. |
|
49 | and shades can be individually controlled. | |
50 | */ |
|
50 | */ | |
51 |
|
51 | |||
52 | /*! |
|
52 | /*! | |
53 | \enum QAbstractAxis::AxisType |
|
53 | \enum QAbstractAxis::AxisType | |
54 |
|
54 | |||
55 | The type of the axis object. |
|
55 | The type of the axis object. | |
56 |
|
56 | |||
57 | \value AxisTypeNoAxis |
|
57 | \value AxisTypeNoAxis | |
58 | \value AxisTypeValue |
|
58 | \value AxisTypeValue | |
59 | \value AxisTypeBarCategory |
|
59 | \value AxisTypeBarCategory | |
60 | \value AxisTypeCategory |
|
60 | \value AxisTypeCategory | |
61 | \value AxisTypeDateTime |
|
61 | \value AxisTypeDateTime | |
62 | \value AxisTypeLogValue |
|
62 | \value AxisTypeLogValue | |
63 | */ |
|
63 | */ | |
64 |
|
64 | |||
65 | /*! |
|
65 | /*! | |
66 | *\fn void QAbstractAxis::type() const |
|
66 | *\fn void QAbstractAxis::type() const | |
67 | Returns the type of the axis |
|
67 | Returns the type of the axis | |
68 | */ |
|
68 | */ | |
69 |
|
69 | |||
70 | /*! |
|
70 | /*! | |
71 | \property QAbstractAxis::lineVisible |
|
71 | \property QAbstractAxis::lineVisible | |
72 | The visibility of the axis line |
|
72 | The visibility of the axis line | |
73 | */ |
|
73 | */ | |
74 | /*! |
|
74 | /*! | |
75 | \qmlproperty bool AbstractAxis::lineVisible |
|
75 | \qmlproperty bool AbstractAxis::lineVisible | |
76 | The visibility of the axis line |
|
76 | The visibility of the axis line | |
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | /*! |
|
79 | /*! | |
80 | \property QAbstractAxis::linePen |
|
80 | \property QAbstractAxis::linePen | |
81 | The pen of the line. |
|
81 | The pen of the line. | |
82 | */ |
|
82 | */ | |
83 |
|
83 | |||
84 | /*! |
|
84 | /*! | |
85 | \property QAbstractAxis::labelsVisible |
|
85 | \property QAbstractAxis::labelsVisible | |
86 | Defines if axis labels are visible. |
|
86 | Defines if axis labels are visible. | |
87 | */ |
|
87 | */ | |
88 | /*! |
|
88 | /*! | |
89 | \qmlproperty bool AbstractAxis::labelsVisible |
|
89 | \qmlproperty bool AbstractAxis::labelsVisible | |
90 | Defines if axis labels are visible. |
|
90 | Defines if axis labels are visible. | |
91 | */ |
|
91 | */ | |
92 |
|
92 | |||
93 | /*! |
|
93 | /*! | |
94 | \property QAbstractAxis::labelsBrush |
|
94 | \property QAbstractAxis::labelsBrush | |
95 | The brush of the labels. Only the color of the brush is relevant. |
|
95 | The brush of the labels. Only the color of the brush is relevant. | |
96 | */ |
|
96 | */ | |
97 |
|
97 | |||
98 | /*! |
|
98 | /*! | |
99 | \property QAbstractAxis::visible |
|
99 | \property QAbstractAxis::visible | |
100 | The visibility of the axis. |
|
100 | The visibility of the axis. | |
101 | */ |
|
101 | */ | |
102 | /*! |
|
102 | /*! | |
103 | \qmlproperty bool AbstractAxis::visible |
|
103 | \qmlproperty bool AbstractAxis::visible | |
104 | The visibility of the axis. |
|
104 | The visibility of the axis. | |
105 | */ |
|
105 | */ | |
106 |
|
106 | |||
107 | /*! |
|
107 | /*! | |
108 | \property QAbstractAxis::gridVisible |
|
108 | \property QAbstractAxis::gridVisible | |
109 | The visibility of the grid lines. |
|
109 | The visibility of the grid lines. | |
110 | */ |
|
110 | */ | |
111 | /*! |
|
111 | /*! | |
112 | \qmlproperty bool AbstractAxis::gridVisible |
|
112 | \qmlproperty bool AbstractAxis::gridVisible | |
113 | The visibility of the grid lines. |
|
113 | The visibility of the grid lines. | |
114 | */ |
|
114 | */ | |
115 |
|
115 | |||
116 | /*! |
|
116 | /*! | |
117 | \property QAbstractAxis::minorGridVisible |
|
117 | \property QAbstractAxis::minorGridVisible | |
118 | The visibility of the minor grid lines. Applies only to QValueAxis. |
|
118 | The visibility of the minor grid lines. Applies only to QValueAxis. | |
119 | */ |
|
119 | */ | |
120 | /*! |
|
120 | /*! | |
121 | \qmlproperty bool AbstractAxis::minorGridVisible |
|
121 | \qmlproperty bool AbstractAxis::minorGridVisible | |
122 | The visibility of the minor grid lines. Applies only to QValueAxis. |
|
122 | The visibility of the minor grid lines. Applies only to QValueAxis. | |
123 | */ |
|
123 | */ | |
124 |
|
124 | |||
125 | /*! |
|
125 | /*! | |
126 | \property QAbstractAxis::color |
|
126 | \property QAbstractAxis::color | |
127 | The color of the axis and ticks. |
|
127 | The color of the axis and ticks. | |
128 | */ |
|
128 | */ | |
129 | /*! |
|
129 | /*! | |
130 | \qmlproperty color AbstractAxis::color |
|
130 | \qmlproperty color AbstractAxis::color | |
131 | The color of the axis and ticks. |
|
131 | The color of the axis and ticks. | |
132 | */ |
|
132 | */ | |
133 |
|
133 | |||
134 | /*! |
|
134 | /*! | |
135 | \property QAbstractAxis::gridLinePen |
|
135 | \property QAbstractAxis::gridLinePen | |
136 | The pen of the grid line. |
|
136 | The pen of the grid line. | |
137 | */ |
|
137 | */ | |
138 |
|
138 | |||
139 | /*! |
|
139 | /*! | |
140 | \property QAbstractAxis::minorGridLinePen |
|
140 | \property QAbstractAxis::minorGridLinePen | |
141 | The pen of the minor grid line. Applies only to QValueAxis. |
|
141 | The pen of the minor grid line. Applies only to QValueAxis. | |
142 | */ |
|
142 | */ | |
143 |
|
143 | |||
144 | /*! |
|
144 | /*! | |
145 | \property QAbstractAxis::labelsFont |
|
145 | \property QAbstractAxis::labelsFont | |
146 | The font of the axis labels. |
|
146 | The font of the axis labels. | |
147 | */ |
|
147 | */ | |
148 |
|
148 | |||
149 | /*! |
|
149 | /*! | |
150 | \qmlproperty Font AbstractAxis::labelsFont |
|
150 | \qmlproperty Font AbstractAxis::labelsFont | |
151 | The font of the axis labels. |
|
151 | The font of the axis labels. | |
152 |
|
152 | |||
153 | See the Qt documentation for more details of Font. |
|
153 | See the Qt documentation for more details of Font. | |
154 | */ |
|
154 | */ | |
155 |
|
155 | |||
156 | /*! |
|
156 | /*! | |
157 | \property QAbstractAxis::labelsColor |
|
157 | \property QAbstractAxis::labelsColor | |
158 | The color of the axis labels. |
|
158 | The color of the axis labels. | |
159 | */ |
|
159 | */ | |
160 | /*! |
|
160 | /*! | |
161 | \qmlproperty color AbstractAxis::labelsColor |
|
161 | \qmlproperty color AbstractAxis::labelsColor | |
162 | The color of the axis labels. |
|
162 | The color of the axis labels. | |
163 | */ |
|
163 | */ | |
164 |
|
164 | |||
165 | /*! |
|
165 | /*! | |
166 | \property QAbstractAxis::labelsAngle |
|
166 | \property QAbstractAxis::labelsAngle | |
167 | The angle of the axis labels in degrees. |
|
167 | The angle of the axis labels in degrees. | |
168 | */ |
|
168 | */ | |
169 | /*! |
|
169 | /*! | |
170 | \qmlproperty int AbstractAxis::labelsAngle |
|
170 | \qmlproperty int AbstractAxis::labelsAngle | |
171 | The angle of the axis labels in degrees. |
|
171 | The angle of the axis labels in degrees. | |
172 | */ |
|
172 | */ | |
173 |
|
173 | |||
174 | /*! |
|
174 | /*! | |
175 | \property QAbstractAxis::shadesVisible |
|
175 | \property QAbstractAxis::shadesVisible | |
176 | The visibility of the axis shades. |
|
176 | The visibility of the axis shades. | |
177 | */ |
|
177 | */ | |
178 | /*! |
|
178 | /*! | |
179 | \qmlproperty bool AbstractAxis::shadesVisible |
|
179 | \qmlproperty bool AbstractAxis::shadesVisible | |
180 | The visibility of the axis shades. |
|
180 | The visibility of the axis shades. | |
181 | */ |
|
181 | */ | |
182 |
|
182 | |||
183 | /*! |
|
183 | /*! | |
184 | \property QAbstractAxis::shadesColor |
|
184 | \property QAbstractAxis::shadesColor | |
185 | The fill (brush) color of the axis shades. |
|
185 | The fill (brush) color of the axis shades. | |
186 | */ |
|
186 | */ | |
187 | /*! |
|
187 | /*! | |
188 | \qmlproperty color AbstractAxis::shadesColor |
|
188 | \qmlproperty color AbstractAxis::shadesColor | |
189 | The fill (brush) color of the axis shades. |
|
189 | The fill (brush) color of the axis shades. | |
190 | */ |
|
190 | */ | |
191 |
|
191 | |||
192 | /*! |
|
192 | /*! | |
193 | \property QAbstractAxis::shadesBorderColor |
|
193 | \property QAbstractAxis::shadesBorderColor | |
194 | The border (pen) color of the axis shades. |
|
194 | The border (pen) color of the axis shades. | |
195 | */ |
|
195 | */ | |
196 | /*! |
|
196 | /*! | |
197 | \qmlproperty color AbstractAxis::shadesBorderColor |
|
197 | \qmlproperty color AbstractAxis::shadesBorderColor | |
198 | The border (pen) color of the axis shades. |
|
198 | The border (pen) color of the axis shades. | |
199 | */ |
|
199 | */ | |
200 |
|
200 | |||
201 | /*! |
|
201 | /*! | |
202 | \property QAbstractAxis::shadesPen |
|
202 | \property QAbstractAxis::shadesPen | |
203 | The pen of the axis shades (area between grid lines). |
|
203 | The pen of the axis shades (area between grid lines). | |
204 | */ |
|
204 | */ | |
205 |
|
205 | |||
206 | /*! |
|
206 | /*! | |
207 | \property QAbstractAxis::shadesBrush |
|
207 | \property QAbstractAxis::shadesBrush | |
208 | The brush of the axis shades (area between grid lines). |
|
208 | The brush of the axis shades (area between grid lines). | |
209 | */ |
|
209 | */ | |
210 |
|
210 | |||
211 | /*! |
|
211 | /*! | |
212 | \property QAbstractAxis::titleVisible |
|
212 | \property QAbstractAxis::titleVisible | |
213 | The visibility of the axis title. By default the value is true. |
|
213 | The visibility of the axis title. By default the value is true. | |
214 | */ |
|
214 | */ | |
215 | /*! |
|
215 | /*! | |
216 | \qmlproperty bool AbstractAxis::titleVisible |
|
216 | \qmlproperty bool AbstractAxis::titleVisible | |
217 | The visibility of the axis title. By default the value is true. |
|
217 | The visibility of the axis title. By default the value is true. | |
218 | */ |
|
218 | */ | |
219 |
|
219 | |||
220 | /*! |
|
220 | /*! | |
221 | \property QAbstractAxis::titleText |
|
221 | \property QAbstractAxis::titleText | |
222 | The title of the axis. Empty by default. Axis titles support html formatting. |
|
222 | The title of the axis. Empty by default. Axis titles support html formatting. | |
223 | */ |
|
223 | */ | |
224 | /*! |
|
224 | /*! | |
225 | \qmlproperty String AbstractAxis::titleText |
|
225 | \qmlproperty String AbstractAxis::titleText | |
226 | The title of the axis. Empty by default. Axis titles support html formatting. |
|
226 | The title of the axis. Empty by default. Axis titles support html formatting. | |
227 | */ |
|
227 | */ | |
228 |
|
228 | |||
229 | /*! |
|
229 | /*! | |
230 | \property QAbstractAxis::titleBrush |
|
230 | \property QAbstractAxis::titleBrush | |
231 | The brush of the title text. Only the color of the brush is relevant. |
|
231 | The brush of the title text. Only the color of the brush is relevant. | |
232 | */ |
|
232 | */ | |
233 |
|
233 | |||
234 | /*! |
|
234 | /*! | |
235 | \property QAbstractAxis::titleFont |
|
235 | \property QAbstractAxis::titleFont | |
236 | The font of the title of the axis. |
|
236 | The font of the title of the axis. | |
237 | */ |
|
237 | */ | |
238 | /*! |
|
238 | /*! | |
239 | \qmlproperty Font AbstractAxis::titleFont |
|
239 | \qmlproperty Font AbstractAxis::titleFont | |
240 | The font of the title of the axis. |
|
240 | The font of the title of the axis. | |
241 | */ |
|
241 | */ | |
242 |
|
242 | |||
243 | /*! |
|
243 | /*! | |
244 | \property QAbstractAxis::orientation |
|
244 | \property QAbstractAxis::orientation | |
245 | The orientation of the axis. Fixed to either Qt::Horizontal or Qt::Vertical when you add the axis to a chart. |
|
245 | The orientation of the axis. Fixed to either Qt::Horizontal or Qt::Vertical when you add the axis to a chart. | |
246 | */ |
|
246 | */ | |
247 | /*! |
|
247 | /*! | |
248 | \qmlproperty Qt.Orientation AbstractAxis::orientation |
|
248 | \qmlproperty Qt.Orientation AbstractAxis::orientation | |
249 | The orientation of the axis. Fixed to either Qt.Horizontal or Qt.Vertical when the axis is set to a series. |
|
249 | The orientation of the axis. Fixed to either Qt.Horizontal or Qt.Vertical when the axis is set to a series. | |
250 | */ |
|
250 | */ | |
251 |
|
251 | |||
252 | /*! |
|
252 | /*! | |
253 | \property QAbstractAxis::alignment |
|
253 | \property QAbstractAxis::alignment | |
254 | The alignment of the axis. Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop. |
|
254 | The alignment of the axis. Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop. | |
255 | */ |
|
255 | */ | |
256 | /*! |
|
256 | /*! | |
257 | \qmlproperty alignment AbstractAxis::alignment |
|
257 | \qmlproperty alignment AbstractAxis::alignment | |
258 | The alignment of the axis. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop. |
|
258 | The alignment of the axis. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop. | |
259 | */ |
|
259 | */ | |
260 |
|
260 | |||
261 | /*! |
|
261 | /*! | |
262 | \property QAbstractAxis::reverse |
|
262 | \property QAbstractAxis::reverse | |
263 | The reverse property defines if reverse axis is used. By default the value is false. |
|
263 | The reverse property defines if reverse axis is used. By default the value is false. | |
264 |
|
264 | |||
265 | Reverse axis is supported with line, spline, scatter and area series with cartesian chart. |
|
265 | Reverse axis is supported with line, spline, scatter and area series with cartesian chart. | |
266 | All axes of the same orientation attached to same series must be reversed if one is reversed or |
|
266 | All axes of the same orientation attached to same series must be reversed if one is reversed or | |
267 | the behavior is undefined. |
|
267 | the behavior is undefined. | |
268 | */ |
|
268 | */ | |
269 | /*! |
|
269 | /*! | |
270 | \qmlproperty alignment AbstractAxis::reverse |
|
270 | \qmlproperty alignment AbstractAxis::reverse | |
271 | The reverse property defines if reverse axis is used. By default the value is false. |
|
271 | The reverse property defines if reverse axis is used. By default the value is false. | |
272 |
|
272 | |||
273 | Reverse axis is supported with line, spline, scatter and area series with cartesian chart. |
|
273 | Reverse axis is supported with line, spline, scatter and area series with cartesian chart. | |
274 | All axes of the same orientation attached to same series must be reversed if one is reversed or |
|
274 | All axes of the same orientation attached to same series must be reversed if one is reversed or | |
275 | the behavior is undefined. |
|
275 | the behavior is undefined. | |
276 | */ |
|
276 | */ | |
277 |
|
277 | |||
278 | /*! |
|
278 | /*! | |
279 | \fn void QAbstractAxis::visibleChanged(bool visible) |
|
279 | \fn void QAbstractAxis::visibleChanged(bool visible) | |
280 | Visibility of the axis has changed to \a visible. |
|
280 | Visibility of the axis has changed to \a visible. | |
281 | */ |
|
281 | */ | |
282 | /*! |
|
282 | /*! | |
283 | \qmlsignal AbstractAxis::onVisibleChanged(bool visible) |
|
283 | \qmlsignal AbstractAxis::onVisibleChanged(bool visible) | |
284 | Visibility of the axis has changed to \a visible. |
|
284 | Visibility of the axis has changed to \a visible. | |
285 | */ |
|
285 | */ | |
286 |
|
286 | |||
287 | /*! |
|
287 | /*! | |
288 | \fn void QAbstractAxis::linePenChanged(const QPen& pen) |
|
288 | \fn void QAbstractAxis::linePenChanged(const QPen& pen) | |
289 | The pen of the line of the axis has changed to \a pen. |
|
289 | The pen of the line of the axis has changed to \a pen. | |
290 | */ |
|
290 | */ | |
291 |
|
291 | |||
292 | /*! |
|
292 | /*! | |
293 | \fn void QAbstractAxis::lineVisibleChanged(bool visible) |
|
293 | \fn void QAbstractAxis::lineVisibleChanged(bool visible) | |
294 | Visibility of the axis line has changed to \a visible. |
|
294 | Visibility of the axis line has changed to \a visible. | |
295 | */ |
|
295 | */ | |
296 | /*! |
|
296 | /*! | |
297 | \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible) |
|
297 | \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible) | |
298 | Visibility of the axis line has changed to \a visible. |
|
298 | Visibility of the axis line has changed to \a visible. | |
299 | */ |
|
299 | */ | |
300 |
|
300 | |||
301 | /*! |
|
301 | /*! | |
302 | \fn void QAbstractAxis::labelsVisibleChanged(bool visible) |
|
302 | \fn void QAbstractAxis::labelsVisibleChanged(bool visible) | |
303 | Visibility of the labels of the axis has changed to \a visible. |
|
303 | Visibility of the labels of the axis has changed to \a visible. | |
304 | */ |
|
304 | */ | |
305 | /*! |
|
305 | /*! | |
306 | \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible) |
|
306 | \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible) | |
307 | Visibility of the labels of the axis has changed to \a visible. |
|
307 | Visibility of the labels of the axis has changed to \a visible. | |
308 | */ |
|
308 | */ | |
309 |
|
309 | |||
310 | /*! |
|
310 | /*! | |
311 | \fn void QAbstractAxis::labelsFontChanged(const QFont& font) |
|
311 | \fn void QAbstractAxis::labelsFontChanged(const QFont& font) | |
312 | The font of the axis labels has changed to \a font. |
|
312 | The font of the axis labels has changed to \a font. | |
313 | */ |
|
313 | */ | |
314 | /*! |
|
314 | /*! | |
315 | \qmlsignal AbstractAxis::onLabelsFontChanged(Font font) |
|
315 | \qmlsignal AbstractAxis::onLabelsFontChanged(Font font) | |
316 | The font of the axis labels has changed to \a font. |
|
316 | The font of the axis labels has changed to \a font. | |
317 | */ |
|
317 | */ | |
318 |
|
318 | |||
319 | /*! |
|
319 | /*! | |
320 | \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush) |
|
320 | \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush) | |
321 | The brush of the axis labels has changed to \a brush. |
|
321 | The brush of the axis labels has changed to \a brush. | |
322 | */ |
|
322 | */ | |
323 |
|
323 | |||
324 | /*! |
|
324 | /*! | |
325 | \fn void QAbstractAxis::labelsAngleChanged(int angle) |
|
325 | \fn void QAbstractAxis::labelsAngleChanged(int angle) | |
326 | The angle of the axis labels has changed to \a angle. |
|
326 | The angle of the axis labels has changed to \a angle. | |
327 | */ |
|
327 | */ | |
328 | /*! |
|
328 | /*! | |
329 | \qmlsignal AbstractAxis::onLabelsAngleChanged(int angle) |
|
329 | \qmlsignal AbstractAxis::onLabelsAngleChanged(int angle) | |
330 | The angle of the axis labels has changed to \a angle. |
|
330 | The angle of the axis labels has changed to \a angle. | |
331 | */ |
|
331 | */ | |
332 |
|
332 | |||
333 | /*! |
|
333 | /*! | |
334 | \fn void QAbstractAxis::gridVisibleChanged(bool visible) |
|
334 | \fn void QAbstractAxis::gridVisibleChanged(bool visible) | |
335 | Visibility of the grid lines of the axis has changed to \a visible. |
|
335 | Visibility of the grid lines of the axis has changed to \a visible. | |
336 | */ |
|
336 | */ | |
337 | /*! |
|
337 | /*! | |
338 | \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible) |
|
338 | \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible) | |
339 | Visibility of the grid lines of the axis has changed to \a visible. |
|
339 | Visibility of the grid lines of the axis has changed to \a visible. | |
340 | */ |
|
340 | */ | |
341 |
|
341 | |||
342 | /*! |
|
342 | /*! | |
343 | \fn void QAbstractAxis::minorGridVisibleChanged(bool visible) |
|
343 | \fn void QAbstractAxis::minorGridVisibleChanged(bool visible) | |
344 | Visibility of the minor grid lines of the axis has changed to \a visible. |
|
344 | Visibility of the minor grid lines of the axis has changed to \a visible. | |
345 | */ |
|
345 | */ | |
346 | /*! |
|
346 | /*! | |
347 | \qmlsignal AbstractAxis::onMinorGridVisibleChanged(bool visible) |
|
347 | \qmlsignal AbstractAxis::onMinorGridVisibleChanged(bool visible) | |
348 | Visibility of the minor grid lines of the axis has changed to \a visible. |
|
348 | Visibility of the minor grid lines of the axis has changed to \a visible. | |
349 | */ |
|
349 | */ | |
350 |
|
350 | |||
351 | /*! |
|
351 | /*! | |
352 | \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen) |
|
352 | \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen) | |
353 | The pen of the grid line has changed to \a pen. |
|
353 | The pen of the grid line has changed to \a pen. | |
354 | */ |
|
354 | */ | |
355 |
|
355 | |||
356 | /*! |
|
356 | /*! | |
357 | \fn void QAbstractAxis::minorGridLinePenChanged(const QPen& pen) |
|
357 | \fn void QAbstractAxis::minorGridLinePenChanged(const QPen& pen) | |
358 | The pen of the minor grid line has changed to \a pen. |
|
358 | The pen of the minor grid line has changed to \a pen. | |
359 | */ |
|
359 | */ | |
360 |
|
360 | |||
361 | /*! |
|
361 | /*! | |
362 | \fn void QAbstractAxis::colorChanged(QColor color) |
|
362 | \fn void QAbstractAxis::colorChanged(QColor color) | |
363 | Emitted if the \a color of the axis is changed. |
|
363 | Emitted if the \a color of the axis is changed. | |
364 | */ |
|
364 | */ | |
365 | /*! |
|
365 | /*! | |
366 | \qmlsignal AbstractAxis::onColorChanged(QColor color) |
|
366 | \qmlsignal AbstractAxis::onColorChanged(QColor color) | |
367 | Emitted if the \a color of the axis is changed. |
|
367 | Emitted if the \a color of the axis is changed. | |
368 | */ |
|
368 | */ | |
369 |
|
369 | |||
370 | /*! |
|
370 | /*! | |
371 | \fn void QAbstractAxis::labelsColorChanged(QColor color) |
|
371 | \fn void QAbstractAxis::labelsColorChanged(QColor color) | |
372 | Emitted if the \a color of the axis labels is changed. |
|
372 | Emitted if the \a color of the axis labels is changed. | |
373 | */ |
|
373 | */ | |
374 | /*! |
|
374 | /*! | |
375 | \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color) |
|
375 | \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color) | |
376 | Emitted if the \a color of the axis labels is changed. |
|
376 | Emitted if the \a color of the axis labels is changed. | |
377 | */ |
|
377 | */ | |
378 |
|
378 | |||
379 | /*! |
|
379 | /*! | |
380 | \fn void QAbstractAxis::titleVisibleChanged(bool visible) |
|
380 | \fn void QAbstractAxis::titleVisibleChanged(bool visible) | |
381 | Visibility of the title text of the axis has changed to \a visible. |
|
381 | Visibility of the title text of the axis has changed to \a visible. | |
382 | */ |
|
382 | */ | |
383 | /*! |
|
383 | /*! | |
384 | \qmlsignal AbstractAxis::onTitleVisibleChanged(bool visible) |
|
384 | \qmlsignal AbstractAxis::onTitleVisibleChanged(bool visible) | |
385 | Visibility of the title text of the axis has changed to \a visible. |
|
385 | Visibility of the title text of the axis has changed to \a visible. | |
386 | */ |
|
386 | */ | |
387 |
|
387 | |||
388 | /*! |
|
388 | /*! | |
389 | \fn void QAbstractAxis::titleTextChanged(const QString& text) |
|
389 | \fn void QAbstractAxis::titleTextChanged(const QString& text) | |
390 | The text of the axis title has changed to \a text. |
|
390 | The text of the axis title has changed to \a text. | |
391 | */ |
|
391 | */ | |
392 | /*! |
|
392 | /*! | |
393 | \qmlsignal AbstractAxis::onTitleTextChanged(String text) |
|
393 | \qmlsignal AbstractAxis::onTitleTextChanged(String text) | |
394 | The text of the axis title has changed to \a text. |
|
394 | The text of the axis title has changed to \a text. | |
395 | */ |
|
395 | */ | |
396 |
|
396 | |||
397 | /*! |
|
397 | /*! | |
398 | \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush) |
|
398 | \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush) | |
399 | The brush of the axis title has changed to \a brush. |
|
399 | The brush of the axis title has changed to \a brush. | |
400 | */ |
|
400 | */ | |
401 |
|
401 | |||
402 | /*! |
|
402 | /*! | |
403 | \fn void QAbstractAxis::titleFontChanged(const QFont& font) |
|
403 | \fn void QAbstractAxis::titleFontChanged(const QFont& font) | |
404 | The font of the axis title has changed to \a font. |
|
404 | The font of the axis title has changed to \a font. | |
405 | */ |
|
405 | */ | |
406 | /*! |
|
406 | /*! | |
407 | \qmlsignal AbstractAxis::onTitleFontChanged(Font font) |
|
407 | \qmlsignal AbstractAxis::onTitleFontChanged(Font font) | |
408 | The font of the axis title has changed to \a font. |
|
408 | The font of the axis title has changed to \a font. | |
409 | */ |
|
409 | */ | |
410 |
|
410 | |||
411 | /*! |
|
411 | /*! | |
412 | \fn void QAbstractAxis::shadesVisibleChanged(bool) |
|
412 | \fn void QAbstractAxis::shadesVisibleChanged(bool) | |
413 | Emitted if the visibility of the axis shades is changed to \a visible. |
|
413 | Emitted if the visibility of the axis shades is changed to \a visible. | |
414 | */ |
|
414 | */ | |
415 | /*! |
|
415 | /*! | |
416 | \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible) |
|
416 | \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible) | |
417 | Emitted if the visibility of the axis shades is changed to \a visible. |
|
417 | Emitted if the visibility of the axis shades is changed to \a visible. | |
418 | */ |
|
418 | */ | |
419 |
|
419 | |||
420 | /*! |
|
420 | /*! | |
421 | \fn void QAbstractAxis::shadesColorChanged(QColor color) |
|
421 | \fn void QAbstractAxis::shadesColorChanged(QColor color) | |
422 | Emitted if the \a color of the axis shades is changed. |
|
422 | Emitted if the \a color of the axis shades is changed. | |
423 | */ |
|
423 | */ | |
424 | /*! |
|
424 | /*! | |
425 | \qmlsignal AbstractAxis::onShadesColorChanged(QColor color) |
|
425 | \qmlsignal AbstractAxis::onShadesColorChanged(QColor color) | |
426 | Emitted if the \a color of the axis shades is changed. |
|
426 | Emitted if the \a color of the axis shades is changed. | |
427 | */ |
|
427 | */ | |
428 |
|
428 | |||
429 | /*! |
|
429 | /*! | |
430 | \fn void QAbstractAxis::shadesBorderColorChanged(QColor) |
|
430 | \fn void QAbstractAxis::shadesBorderColorChanged(QColor) | |
431 | Emitted if the border \a color of the axis shades is changed. |
|
431 | Emitted if the border \a color of the axis shades is changed. | |
432 | */ |
|
432 | */ | |
433 | /*! |
|
433 | /*! | |
434 | \qmlsignal AbstractAxis::onBorderColorChanged(QColor color) |
|
434 | \qmlsignal AbstractAxis::onBorderColorChanged(QColor color) | |
435 | Emitted if the border \a color of the axis shades is changed. |
|
435 | Emitted if the border \a color of the axis shades is changed. | |
436 | */ |
|
436 | */ | |
437 |
|
437 | |||
438 | /*! |
|
438 | /*! | |
439 | \fn void QAbstractAxis::shadesBrushChanged(const QBrush& brush) |
|
439 | \fn void QAbstractAxis::shadesBrushChanged(const QBrush& brush) | |
440 | The brush of the axis shades has changed to \a brush. |
|
440 | The brush of the axis shades has changed to \a brush. | |
441 | */ |
|
441 | */ | |
442 |
|
442 | |||
443 | /*! |
|
443 | /*! | |
444 | \fn void QAbstractAxis::shadesPenChanged(const QPen& pen) |
|
444 | \fn void QAbstractAxis::shadesPenChanged(const QPen& pen) | |
445 | The pen of the axis shades has changed to \a pen. |
|
445 | The pen of the axis shades has changed to \a pen. | |
446 | */ |
|
446 | */ | |
447 |
|
447 | |||
448 | /*! |
|
448 | /*! | |
449 | \internal |
|
449 | \internal | |
450 | Constructs new axis object which is a child of \a parent. Ownership is taken by |
|
450 | Constructs new axis object which is a child of \a parent. Ownership is taken by | |
451 | QChart when axis added. |
|
451 | QChart when axis added. | |
452 | */ |
|
452 | */ | |
453 |
|
453 | |||
454 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) |
|
454 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) | |
455 | : QObject(parent), |
|
455 | : QObject(parent), | |
456 | d_ptr(&d) |
|
456 | d_ptr(&d) | |
457 | { |
|
457 | { | |
458 | } |
|
458 | } | |
459 |
|
459 | |||
460 | /*! |
|
460 | /*! | |
461 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. |
|
461 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. | |
462 | */ |
|
462 | */ | |
463 |
|
463 | |||
464 | QAbstractAxis::~QAbstractAxis() |
|
464 | QAbstractAxis::~QAbstractAxis() | |
465 | { |
|
465 | { | |
466 | if (d_ptr->m_chart) |
|
466 | if (d_ptr->m_chart) | |
467 | qFatal("Still binded axis detected !"); |
|
467 | qFatal("Still binded axis detected !"); | |
468 | } |
|
468 | } | |
469 |
|
469 | |||
470 | /*! |
|
470 | /*! | |
471 | Sets \a pen used to draw axis line and ticks. |
|
471 | Sets \a pen used to draw axis line and ticks. | |
472 | */ |
|
472 | */ | |
473 | void QAbstractAxis::setLinePen(const QPen &pen) |
|
473 | void QAbstractAxis::setLinePen(const QPen &pen) | |
474 | { |
|
474 | { | |
475 | if (d_ptr->m_axisPen != pen) { |
|
475 | if (d_ptr->m_axisPen != pen) { | |
476 | d_ptr->m_axisPen = pen; |
|
476 | d_ptr->m_axisPen = pen; | |
477 | emit linePenChanged(pen); |
|
477 | emit linePenChanged(pen); | |
478 | } |
|
478 | } | |
479 | } |
|
479 | } | |
480 |
|
480 | |||
481 | /*! |
|
481 | /*! | |
482 | Returns pen used to draw axis and ticks. |
|
482 | Returns pen used to draw axis and ticks. | |
483 | */ |
|
483 | */ | |
484 | QPen QAbstractAxis::linePen() const |
|
484 | QPen QAbstractAxis::linePen() const | |
485 | { |
|
485 | { | |
486 | if (d_ptr->m_axisPen == QChartPrivate::defaultPen()) |
|
486 | if (d_ptr->m_axisPen == QChartPrivate::defaultPen()) | |
487 | return QPen(); |
|
487 | return QPen(); | |
488 | else |
|
488 | else | |
489 | return d_ptr->m_axisPen; |
|
489 | return d_ptr->m_axisPen; | |
490 | } |
|
490 | } | |
491 |
|
491 | |||
492 | void QAbstractAxis::setLinePenColor(QColor color) |
|
492 | void QAbstractAxis::setLinePenColor(QColor color) | |
493 | { |
|
493 | { | |
494 | QPen p = d_ptr->m_axisPen; |
|
494 | QPen p = d_ptr->m_axisPen; | |
495 | if (p.color() != color) { |
|
495 | if (p.color() != color) { | |
496 | p.setColor(color); |
|
496 | p.setColor(color); | |
497 | setLinePen(p); |
|
497 | setLinePen(p); | |
498 | emit colorChanged(color); |
|
498 | emit colorChanged(color); | |
499 | } |
|
499 | } | |
500 | } |
|
500 | } | |
501 |
|
501 | |||
502 | QColor QAbstractAxis::linePenColor() const |
|
502 | QColor QAbstractAxis::linePenColor() const | |
503 | { |
|
503 | { | |
504 | return linePen().color(); |
|
504 | return linePen().color(); | |
505 | } |
|
505 | } | |
506 |
|
506 | |||
507 | /*! |
|
507 | /*! | |
508 | Sets if axis and ticks are \a visible. |
|
508 | Sets if axis and ticks are \a visible. | |
509 | */ |
|
509 | */ | |
510 | void QAbstractAxis::setLineVisible(bool visible) |
|
510 | void QAbstractAxis::setLineVisible(bool visible) | |
511 | { |
|
511 | { | |
512 | if (d_ptr->m_arrowVisible != visible) { |
|
512 | if (d_ptr->m_arrowVisible != visible) { | |
513 | d_ptr->m_arrowVisible = visible; |
|
513 | d_ptr->m_arrowVisible = visible; | |
514 | emit lineVisibleChanged(visible); |
|
514 | emit lineVisibleChanged(visible); | |
515 | } |
|
515 | } | |
516 | } |
|
516 | } | |
517 |
|
517 | |||
518 | bool QAbstractAxis::isLineVisible() const |
|
518 | bool QAbstractAxis::isLineVisible() const | |
519 | { |
|
519 | { | |
520 | return d_ptr->m_arrowVisible; |
|
520 | return d_ptr->m_arrowVisible; | |
521 | } |
|
521 | } | |
522 |
|
522 | |||
523 | void QAbstractAxis::setGridLineVisible(bool visible) |
|
523 | void QAbstractAxis::setGridLineVisible(bool visible) | |
524 | { |
|
524 | { | |
525 | if (d_ptr->m_gridLineVisible != visible) { |
|
525 | if (d_ptr->m_gridLineVisible != visible) { | |
526 | d_ptr->m_gridLineVisible = visible; |
|
526 | d_ptr->m_gridLineVisible = visible; | |
527 | emit gridVisibleChanged(visible); |
|
527 | emit gridVisibleChanged(visible); | |
528 | } |
|
528 | } | |
529 | } |
|
529 | } | |
530 |
|
530 | |||
531 | bool QAbstractAxis::isGridLineVisible() const |
|
531 | bool QAbstractAxis::isGridLineVisible() const | |
532 | { |
|
532 | { | |
533 | return d_ptr->m_gridLineVisible; |
|
533 | return d_ptr->m_gridLineVisible; | |
534 | } |
|
534 | } | |
535 |
|
535 | |||
536 | void QAbstractAxis::setMinorGridLineVisible(bool visible) |
|
536 | void QAbstractAxis::setMinorGridLineVisible(bool visible) | |
537 | { |
|
537 | { | |
538 | if (d_ptr->m_minorGridLineVisible != visible) { |
|
538 | if (d_ptr->m_minorGridLineVisible != visible) { | |
539 | d_ptr->m_minorGridLineVisible = visible; |
|
539 | d_ptr->m_minorGridLineVisible = visible; | |
540 | emit minorGridVisibleChanged(visible); |
|
540 | emit minorGridVisibleChanged(visible); | |
541 | } |
|
541 | } | |
542 | } |
|
542 | } | |
543 |
|
543 | |||
544 | bool QAbstractAxis::isMinorGridLineVisible() const |
|
544 | bool QAbstractAxis::isMinorGridLineVisible() const | |
545 | { |
|
545 | { | |
546 | return d_ptr->m_minorGridLineVisible; |
|
546 | return d_ptr->m_minorGridLineVisible; | |
547 | } |
|
547 | } | |
548 |
|
548 | |||
549 | /*! |
|
549 | /*! | |
550 | Sets \a pen used to draw grid line. |
|
550 | Sets \a pen used to draw grid line. | |
551 | */ |
|
551 | */ | |
552 | void QAbstractAxis::setGridLinePen(const QPen &pen) |
|
552 | void QAbstractAxis::setGridLinePen(const QPen &pen) | |
553 | { |
|
553 | { | |
554 | if (d_ptr->m_gridLinePen != pen) { |
|
554 | if (d_ptr->m_gridLinePen != pen) { | |
555 | d_ptr->m_gridLinePen = pen; |
|
555 | d_ptr->m_gridLinePen = pen; | |
556 | emit gridLinePenChanged(pen); |
|
556 | emit gridLinePenChanged(pen); | |
557 | } |
|
557 | } | |
558 | } |
|
558 | } | |
559 |
|
559 | |||
560 | /*! |
|
560 | /*! | |
561 | Returns pen used to draw grid. |
|
561 | Returns pen used to draw grid. | |
562 | */ |
|
562 | */ | |
563 | QPen QAbstractAxis::gridLinePen() const |
|
563 | QPen QAbstractAxis::gridLinePen() const | |
564 | { |
|
564 | { | |
565 | if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen()) |
|
565 | if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen()) | |
566 | return QPen(); |
|
566 | return QPen(); | |
567 | else |
|
567 | else | |
568 | return d_ptr->m_gridLinePen; |
|
568 | return d_ptr->m_gridLinePen; | |
569 | } |
|
569 | } | |
570 |
|
570 | |||
571 | void QAbstractAxis::setMinorGridLinePen(const QPen &pen) |
|
571 | void QAbstractAxis::setMinorGridLinePen(const QPen &pen) | |
572 | { |
|
572 | { | |
573 | if (d_ptr->m_minorGridLinePen != pen) { |
|
573 | if (d_ptr->m_minorGridLinePen != pen) { | |
574 | d_ptr->m_minorGridLinePen = pen; |
|
574 | d_ptr->m_minorGridLinePen = pen; | |
575 | emit minorGridLinePenChanged(pen); |
|
575 | emit minorGridLinePenChanged(pen); | |
576 | } |
|
576 | } | |
577 | } |
|
577 | } | |
578 |
|
578 | |||
579 | QPen QAbstractAxis::minorGridLinePen() const |
|
579 | QPen QAbstractAxis::minorGridLinePen() const | |
580 | { |
|
580 | { | |
581 | if (d_ptr->m_minorGridLinePen == QChartPrivate::defaultPen()) |
|
581 | if (d_ptr->m_minorGridLinePen == QChartPrivate::defaultPen()) | |
582 | return QPen(); |
|
582 | return QPen(); | |
583 | else |
|
583 | else | |
584 | return d_ptr->m_minorGridLinePen; |
|
584 | return d_ptr->m_minorGridLinePen; | |
585 | } |
|
585 | } | |
586 |
|
586 | |||
587 | void QAbstractAxis::setLabelsVisible(bool visible) |
|
587 | void QAbstractAxis::setLabelsVisible(bool visible) | |
588 | { |
|
588 | { | |
589 | if (d_ptr->m_labelsVisible != visible) { |
|
589 | if (d_ptr->m_labelsVisible != visible) { | |
590 | d_ptr->m_labelsVisible = visible; |
|
590 | d_ptr->m_labelsVisible = visible; | |
591 | emit labelsVisibleChanged(visible); |
|
591 | emit labelsVisibleChanged(visible); | |
592 | } |
|
592 | } | |
593 | } |
|
593 | } | |
594 |
|
594 | |||
595 | bool QAbstractAxis::labelsVisible() const |
|
595 | bool QAbstractAxis::labelsVisible() const | |
596 | { |
|
596 | { | |
597 | return d_ptr->m_labelsVisible; |
|
597 | return d_ptr->m_labelsVisible; | |
598 | } |
|
598 | } | |
599 |
|
599 | |||
600 | /*! |
|
600 | /*! | |
601 | Sets \a brush used to draw labels. |
|
601 | Sets \a brush used to draw labels. | |
602 | */ |
|
602 | */ | |
603 | void QAbstractAxis::setLabelsBrush(const QBrush &brush) |
|
603 | void QAbstractAxis::setLabelsBrush(const QBrush &brush) | |
604 | { |
|
604 | { | |
605 | if (d_ptr->m_labelsBrush != brush) { |
|
605 | if (d_ptr->m_labelsBrush != brush) { | |
606 | d_ptr->m_labelsBrush = brush; |
|
606 | d_ptr->m_labelsBrush = brush; | |
607 | emit labelsBrushChanged(brush); |
|
607 | emit labelsBrushChanged(brush); | |
608 | } |
|
608 | } | |
609 | } |
|
609 | } | |
610 |
|
610 | |||
611 | /*! |
|
611 | /*! | |
612 | Returns brush used to draw labels. |
|
612 | Returns brush used to draw labels. | |
613 | */ |
|
613 | */ | |
614 | QBrush QAbstractAxis::labelsBrush() const |
|
614 | QBrush QAbstractAxis::labelsBrush() const | |
615 | { |
|
615 | { | |
616 | if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush()) |
|
616 | if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush()) | |
617 | return QBrush(); |
|
617 | return QBrush(); | |
618 | else |
|
618 | else | |
619 | return d_ptr->m_labelsBrush; |
|
619 | return d_ptr->m_labelsBrush; | |
620 | } |
|
620 | } | |
621 |
|
621 | |||
622 | /*! |
|
622 | /*! | |
623 | Sets \a font used to draw labels. |
|
623 | Sets \a font used to draw labels. | |
624 | */ |
|
624 | */ | |
625 | void QAbstractAxis::setLabelsFont(const QFont &font) |
|
625 | void QAbstractAxis::setLabelsFont(const QFont &font) | |
626 | { |
|
626 | { | |
627 | if (d_ptr->m_labelsFont != font) { |
|
627 | if (d_ptr->m_labelsFont != font) { | |
628 | d_ptr->m_labelsFont = font; |
|
628 | d_ptr->m_labelsFont = font; | |
629 | emit labelsFontChanged(font); |
|
629 | emit labelsFontChanged(font); | |
630 | } |
|
630 | } | |
631 | } |
|
631 | } | |
632 |
|
632 | |||
633 | /*! |
|
633 | /*! | |
634 | Returns font used to draw labels. |
|
634 | Returns font used to draw labels. | |
635 | */ |
|
635 | */ | |
636 | QFont QAbstractAxis::labelsFont() const |
|
636 | QFont QAbstractAxis::labelsFont() const | |
637 | { |
|
637 | { | |
638 | if (d_ptr->m_labelsFont == QChartPrivate::defaultFont()) |
|
638 | if (d_ptr->m_labelsFont == QChartPrivate::defaultFont()) | |
639 | return QFont(); |
|
639 | return QFont(); | |
640 | else |
|
640 | else | |
641 | return d_ptr->m_labelsFont; |
|
641 | return d_ptr->m_labelsFont; | |
642 | } |
|
642 | } | |
643 |
|
643 | |||
644 | void QAbstractAxis::setLabelsAngle(int angle) |
|
644 | void QAbstractAxis::setLabelsAngle(int angle) | |
645 | { |
|
645 | { | |
646 | if (d_ptr->m_labelsAngle != angle) { |
|
646 | if (d_ptr->m_labelsAngle != angle) { | |
647 | d_ptr->m_labelsAngle = angle; |
|
647 | d_ptr->m_labelsAngle = angle; | |
648 | emit labelsAngleChanged(angle); |
|
648 | emit labelsAngleChanged(angle); | |
649 | } |
|
649 | } | |
650 | } |
|
650 | } | |
651 |
|
651 | |||
652 | int QAbstractAxis::labelsAngle() const |
|
652 | int QAbstractAxis::labelsAngle() const | |
653 | { |
|
653 | { | |
654 | return d_ptr->m_labelsAngle; |
|
654 | return d_ptr->m_labelsAngle; | |
655 | } |
|
655 | } | |
656 | void QAbstractAxis::setLabelsColor(QColor color) |
|
656 | void QAbstractAxis::setLabelsColor(QColor color) | |
657 | { |
|
657 | { | |
658 | QBrush b = d_ptr->m_labelsBrush; |
|
658 | QBrush b = d_ptr->m_labelsBrush; | |
659 | if (b.color() != color) { |
|
659 | if (b.color() != color) { | |
660 | b.setColor(color); |
|
660 | b.setColor(color); | |
661 | setLabelsBrush(b); |
|
661 | setLabelsBrush(b); | |
662 | emit labelsColorChanged(color); |
|
662 | emit labelsColorChanged(color); | |
663 | } |
|
663 | } | |
664 | } |
|
664 | } | |
665 |
|
665 | |||
666 | QColor QAbstractAxis::labelsColor() const |
|
666 | QColor QAbstractAxis::labelsColor() const | |
667 | { |
|
667 | { | |
668 | return labelsBrush().color(); |
|
668 | return labelsBrush().color(); | |
669 | } |
|
669 | } | |
670 |
|
670 | |||
671 | void QAbstractAxis::setTitleVisible(bool visible) |
|
671 | void QAbstractAxis::setTitleVisible(bool visible) | |
672 | { |
|
672 | { | |
673 | if (d_ptr->m_titleVisible != visible) { |
|
673 | if (d_ptr->m_titleVisible != visible) { | |
674 | d_ptr->m_titleVisible = visible; |
|
674 | d_ptr->m_titleVisible = visible; | |
675 | emit titleVisibleChanged(visible); |
|
675 | emit titleVisibleChanged(visible); | |
676 | } |
|
676 | } | |
677 | } |
|
677 | } | |
678 |
|
678 | |||
679 | bool QAbstractAxis::isTitleVisible() const |
|
679 | bool QAbstractAxis::isTitleVisible() const | |
680 | { |
|
680 | { | |
681 | return d_ptr->m_titleVisible; |
|
681 | return d_ptr->m_titleVisible; | |
682 | } |
|
682 | } | |
683 |
|
683 | |||
684 | /*! |
|
684 | /*! | |
685 | Sets \a brush used to draw title. |
|
685 | Sets \a brush used to draw title. | |
686 | */ |
|
686 | */ | |
687 | void QAbstractAxis::setTitleBrush(const QBrush &brush) |
|
687 | void QAbstractAxis::setTitleBrush(const QBrush &brush) | |
688 | { |
|
688 | { | |
689 | if (d_ptr->m_titleBrush != brush) { |
|
689 | if (d_ptr->m_titleBrush != brush) { | |
690 | d_ptr->m_titleBrush = brush; |
|
690 | d_ptr->m_titleBrush = brush; | |
691 | emit titleBrushChanged(brush); |
|
691 | emit titleBrushChanged(brush); | |
692 | } |
|
692 | } | |
693 | } |
|
693 | } | |
694 |
|
694 | |||
695 | /*! |
|
695 | /*! | |
696 | Returns brush used to draw title. |
|
696 | Returns brush used to draw title. | |
697 | */ |
|
697 | */ | |
698 | QBrush QAbstractAxis::titleBrush() const |
|
698 | QBrush QAbstractAxis::titleBrush() const | |
699 | { |
|
699 | { | |
700 | if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush()) |
|
700 | if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush()) | |
701 | return QBrush(); |
|
701 | return QBrush(); | |
702 | else |
|
702 | else | |
703 | return d_ptr->m_titleBrush; |
|
703 | return d_ptr->m_titleBrush; | |
704 | } |
|
704 | } | |
705 |
|
705 | |||
706 | /*! |
|
706 | /*! | |
707 | Sets \a font used to draw title. |
|
707 | Sets \a font used to draw title. | |
708 | */ |
|
708 | */ | |
709 | void QAbstractAxis::setTitleFont(const QFont &font) |
|
709 | void QAbstractAxis::setTitleFont(const QFont &font) | |
710 | { |
|
710 | { | |
711 | if (d_ptr->m_titleFont != font) { |
|
711 | if (d_ptr->m_titleFont != font) { | |
712 | d_ptr->m_titleFont = font; |
|
712 | d_ptr->m_titleFont = font; | |
713 | emit titleFontChanged(font); |
|
713 | emit titleFontChanged(font); | |
714 | } |
|
714 | } | |
715 | } |
|
715 | } | |
716 |
|
716 | |||
717 | /*! |
|
717 | /*! | |
718 | Returns font used to draw title. |
|
718 | Returns font used to draw title. | |
719 | */ |
|
719 | */ | |
720 | QFont QAbstractAxis::titleFont() const |
|
720 | QFont QAbstractAxis::titleFont() const | |
721 | { |
|
721 | { | |
722 | if (d_ptr->m_titleFont == QChartPrivate::defaultFont()) |
|
722 | if (d_ptr->m_titleFont == QChartPrivate::defaultFont()) | |
723 | return QFont(); |
|
723 | return QFont(); | |
724 | else |
|
724 | else | |
725 | return d_ptr->m_titleFont; |
|
725 | return d_ptr->m_titleFont; | |
726 | } |
|
726 | } | |
727 |
|
727 | |||
728 | void QAbstractAxis::setTitleText(const QString &title) |
|
728 | void QAbstractAxis::setTitleText(const QString &title) | |
729 | { |
|
729 | { | |
730 | if (d_ptr->m_title != title) { |
|
730 | if (d_ptr->m_title != title) { | |
731 | d_ptr->m_title = title; |
|
731 | d_ptr->m_title = title; | |
732 | emit titleTextChanged(title); |
|
732 | emit titleTextChanged(title); | |
733 | } |
|
733 | } | |
734 | } |
|
734 | } | |
735 |
|
735 | |||
736 | QString QAbstractAxis::titleText() const |
|
736 | QString QAbstractAxis::titleText() const | |
737 | { |
|
737 | { | |
738 | return d_ptr->m_title; |
|
738 | return d_ptr->m_title; | |
739 | } |
|
739 | } | |
740 |
|
740 | |||
741 |
|
741 | |||
742 | void QAbstractAxis::setShadesVisible(bool visible) |
|
742 | void QAbstractAxis::setShadesVisible(bool visible) | |
743 | { |
|
743 | { | |
744 | if (d_ptr->m_shadesVisible != visible) { |
|
744 | if (d_ptr->m_shadesVisible != visible) { | |
745 | d_ptr->m_shadesVisible = visible; |
|
745 | d_ptr->m_shadesVisible = visible; | |
746 | emit shadesVisibleChanged(visible); |
|
746 | emit shadesVisibleChanged(visible); | |
747 | } |
|
747 | } | |
748 | } |
|
748 | } | |
749 |
|
749 | |||
750 | bool QAbstractAxis::shadesVisible() const |
|
750 | bool QAbstractAxis::shadesVisible() const | |
751 | { |
|
751 | { | |
752 | return d_ptr->m_shadesVisible; |
|
752 | return d_ptr->m_shadesVisible; | |
753 | } |
|
753 | } | |
754 |
|
754 | |||
755 | /*! |
|
755 | /*! | |
756 | Sets \a pen used to draw shades. |
|
756 | Sets \a pen used to draw shades. | |
757 | */ |
|
757 | */ | |
758 | void QAbstractAxis::setShadesPen(const QPen &pen) |
|
758 | void QAbstractAxis::setShadesPen(const QPen &pen) | |
759 | { |
|
759 | { | |
760 | if (d_ptr->m_shadesPen != pen) { |
|
760 | if (d_ptr->m_shadesPen != pen) { | |
761 | d_ptr->m_shadesPen = pen; |
|
761 | d_ptr->m_shadesPen = pen; | |
762 | emit shadesPenChanged(pen); |
|
762 | emit shadesPenChanged(pen); | |
763 | } |
|
763 | } | |
764 | } |
|
764 | } | |
765 |
|
765 | |||
766 | /*! |
|
766 | /*! | |
767 | Returns pen used to draw shades. |
|
767 | Returns pen used to draw shades. | |
768 | */ |
|
768 | */ | |
769 | QPen QAbstractAxis::shadesPen() const |
|
769 | QPen QAbstractAxis::shadesPen() const | |
770 | { |
|
770 | { | |
771 | if (d_ptr->m_shadesPen == QChartPrivate::defaultPen()) |
|
771 | if (d_ptr->m_shadesPen == QChartPrivate::defaultPen()) | |
772 | return QPen(); |
|
772 | return QPen(); | |
773 | else |
|
773 | else | |
774 | return d_ptr->m_shadesPen; |
|
774 | return d_ptr->m_shadesPen; | |
775 | } |
|
775 | } | |
776 |
|
776 | |||
777 | /*! |
|
777 | /*! | |
778 | Sets \a brush used to draw shades. |
|
778 | Sets \a brush used to draw shades. | |
779 | */ |
|
779 | */ | |
780 | void QAbstractAxis::setShadesBrush(const QBrush &brush) |
|
780 | void QAbstractAxis::setShadesBrush(const QBrush &brush) | |
781 | { |
|
781 | { | |
782 | if (d_ptr->m_shadesBrush != brush) { |
|
782 | if (d_ptr->m_shadesBrush != brush) { | |
783 | d_ptr->m_shadesBrush = brush; |
|
783 | d_ptr->m_shadesBrush = brush; | |
784 | emit shadesBrushChanged(brush); |
|
784 | emit shadesBrushChanged(brush); | |
785 | } |
|
785 | } | |
786 | } |
|
786 | } | |
787 |
|
787 | |||
788 | /*! |
|
788 | /*! | |
789 | Returns brush used to draw shades. |
|
789 | Returns brush used to draw shades. | |
790 | */ |
|
790 | */ | |
791 | QBrush QAbstractAxis::shadesBrush() const |
|
791 | QBrush QAbstractAxis::shadesBrush() const | |
792 | { |
|
792 | { | |
793 | if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush()) |
|
793 | if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush()) | |
794 | return QBrush(Qt::SolidPattern); |
|
794 | return QBrush(Qt::SolidPattern); | |
795 | else |
|
795 | else | |
796 | return d_ptr->m_shadesBrush; |
|
796 | return d_ptr->m_shadesBrush; | |
797 | } |
|
797 | } | |
798 |
|
798 | |||
799 | void QAbstractAxis::setShadesColor(QColor color) |
|
799 | void QAbstractAxis::setShadesColor(QColor color) | |
800 | { |
|
800 | { | |
801 | QBrush b = d_ptr->m_shadesBrush; |
|
801 | QBrush b = d_ptr->m_shadesBrush; | |
802 | if (b.color() != color) { |
|
802 | if (b.color() != color) { | |
803 | b.setColor(color); |
|
803 | b.setColor(color); | |
804 | setShadesBrush(b); |
|
804 | setShadesBrush(b); | |
805 | emit shadesColorChanged(color); |
|
805 | emit shadesColorChanged(color); | |
806 | } |
|
806 | } | |
807 | } |
|
807 | } | |
808 |
|
808 | |||
809 | QColor QAbstractAxis::shadesColor() const |
|
809 | QColor QAbstractAxis::shadesColor() const | |
810 | { |
|
810 | { | |
811 | return shadesBrush().color(); |
|
811 | return shadesBrush().color(); | |
812 | } |
|
812 | } | |
813 |
|
813 | |||
814 | void QAbstractAxis::setShadesBorderColor(QColor color) |
|
814 | void QAbstractAxis::setShadesBorderColor(QColor color) | |
815 | { |
|
815 | { | |
816 | QPen p = d_ptr->m_shadesPen; |
|
816 | QPen p = d_ptr->m_shadesPen; | |
817 | if (p.color() != color) { |
|
817 | if (p.color() != color) { | |
818 | p.setColor(color); |
|
818 | p.setColor(color); | |
819 | setShadesPen(p); |
|
819 | setShadesPen(p); | |
820 | emit shadesColorChanged(color); |
|
820 | emit shadesColorChanged(color); | |
821 | } |
|
821 | } | |
822 | } |
|
822 | } | |
823 |
|
823 | |||
824 | QColor QAbstractAxis::shadesBorderColor() const |
|
824 | QColor QAbstractAxis::shadesBorderColor() const | |
825 | { |
|
825 | { | |
826 | return shadesPen().color(); |
|
826 | return shadesPen().color(); | |
827 | } |
|
827 | } | |
828 |
|
828 | |||
829 |
|
829 | |||
830 | bool QAbstractAxis::isVisible() const |
|
830 | bool QAbstractAxis::isVisible() const | |
831 | { |
|
831 | { | |
832 | return d_ptr->m_visible; |
|
832 | return d_ptr->m_visible; | |
833 | } |
|
833 | } | |
834 |
|
834 | |||
835 | /*! |
|
835 | /*! | |
836 | Sets axis, shades, labels and grid lines to be visible. |
|
836 | Sets axis, shades, labels and grid lines to be visible. | |
837 | */ |
|
837 | */ | |
838 | void QAbstractAxis::setVisible(bool visible) |
|
838 | void QAbstractAxis::setVisible(bool visible) | |
839 | { |
|
839 | { | |
840 | if (d_ptr->m_visible != visible) { |
|
840 | if (d_ptr->m_visible != visible) { | |
841 | d_ptr->m_visible = visible; |
|
841 | d_ptr->m_visible = visible; | |
842 | emit visibleChanged(visible); |
|
842 | emit visibleChanged(visible); | |
843 | } |
|
843 | } | |
844 | } |
|
844 | } | |
845 |
|
845 | |||
846 |
|
846 | |||
847 | /*! |
|
847 | /*! | |
848 | Sets axis, shades, labels and grid lines to be visible. |
|
848 | Sets axis, shades, labels and grid lines to be visible. | |
849 | */ |
|
849 | */ | |
850 | void QAbstractAxis::show() |
|
850 | void QAbstractAxis::show() | |
851 | { |
|
851 | { | |
852 | setVisible(true); |
|
852 | setVisible(true); | |
853 | } |
|
853 | } | |
854 |
|
854 | |||
855 | /*! |
|
855 | /*! | |
856 | Sets axis, shades, labels and grid lines to not be visible. |
|
856 | Sets axis, shades, labels and grid lines to not be visible. | |
857 | */ |
|
857 | */ | |
858 | void QAbstractAxis::hide() |
|
858 | void QAbstractAxis::hide() | |
859 | { |
|
859 | { | |
860 | setVisible(false); |
|
860 | setVisible(false); | |
861 | } |
|
861 | } | |
862 |
|
862 | |||
863 | /*! |
|
863 | /*! | |
864 | Sets the minimum value shown on the axis. |
|
864 | Sets the minimum value shown on the axis. | |
865 | Depending on the actual axis type the \a min parameter is converted to appropriate type. |
|
865 | Depending on the actual axis type the \a min parameter is converted to appropriate type. | |
866 | If the conversion is impossible then the function call does nothing |
|
866 | If the conversion is impossible then the function call does nothing | |
867 | */ |
|
867 | */ | |
868 | void QAbstractAxis::setMin(const QVariant &min) |
|
868 | void QAbstractAxis::setMin(const QVariant &min) | |
869 | { |
|
869 | { | |
870 | d_ptr->setMin(min); |
|
870 | d_ptr->setMin(min); | |
871 | } |
|
871 | } | |
872 |
|
872 | |||
873 | /*! |
|
873 | /*! | |
874 | Sets the maximum value shown on the axis. |
|
874 | Sets the maximum value shown on the axis. | |
875 | Depending on the actual axis type the \a max parameter is converted to appropriate type. |
|
875 | Depending on the actual axis type the \a max parameter is converted to appropriate type. | |
876 | If the conversion is impossible then the function call does nothing |
|
876 | If the conversion is impossible then the function call does nothing | |
877 | */ |
|
877 | */ | |
878 | void QAbstractAxis::setMax(const QVariant &max) |
|
878 | void QAbstractAxis::setMax(const QVariant &max) | |
879 | { |
|
879 | { | |
880 | d_ptr->setMax(max); |
|
880 | d_ptr->setMax(max); | |
881 | } |
|
881 | } | |
882 |
|
882 | |||
883 | /*! |
|
883 | /*! | |
884 | Sets the range shown on the axis. |
|
884 | Sets the range shown on the axis. | |
885 | Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types. |
|
885 | Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types. | |
886 | If the conversion is impossible then the function call does nothing. |
|
886 | If the conversion is impossible then the function call does nothing. | |
887 | */ |
|
887 | */ | |
888 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) |
|
888 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) | |
889 | { |
|
889 | { | |
890 | d_ptr->setRange(min, max); |
|
890 | d_ptr->setRange(min, max); | |
891 | } |
|
891 | } | |
892 |
|
892 | |||
893 |
|
893 | |||
894 | /*! |
|
894 | /*! | |
895 | Returns the orientation in which the axis is being used (Vertical or Horizontal) |
|
895 | Returns the orientation in which the axis is being used (Vertical or Horizontal) | |
896 | */ |
|
896 | */ | |
897 | Qt::Orientation QAbstractAxis::orientation() const |
|
897 | Qt::Orientation QAbstractAxis::orientation() const | |
898 | { |
|
898 | { | |
899 | return d_ptr->orientation(); |
|
899 | return d_ptr->orientation(); | |
900 | } |
|
900 | } | |
901 |
|
901 | |||
902 | Qt::Alignment QAbstractAxis::alignment() const |
|
902 | Qt::Alignment QAbstractAxis::alignment() const | |
903 | { |
|
903 | { | |
904 | return d_ptr->alignment(); |
|
904 | return d_ptr->alignment(); | |
905 | } |
|
905 | } | |
906 |
|
906 | |||
907 | bool QAbstractAxis::isReverse() const |
|
907 | bool QAbstractAxis::isReverse() const | |
908 | { |
|
908 | { | |
909 | return d_ptr->m_reverse; |
|
909 | return d_ptr->m_reverse; | |
910 | } |
|
910 | } | |
911 |
|
911 | |||
912 | void QAbstractAxis::setReverse(bool reverse) |
|
912 | void QAbstractAxis::setReverse(bool reverse) | |
913 | { |
|
913 | { | |
914 | if (d_ptr->m_reverse != reverse && type() != QAbstractAxis::AxisTypeBarCategory) { |
|
914 | if (d_ptr->m_reverse != reverse && type() != QAbstractAxis::AxisTypeBarCategory) { | |
915 | d_ptr->m_reverse = reverse; |
|
915 | d_ptr->m_reverse = reverse; | |
916 | emit reverseChanged(reverse); |
|
916 | emit reverseChanged(reverse); | |
917 | } |
|
917 | } | |
918 | } |
|
918 | } | |
919 |
|
919 | |||
920 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
920 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
921 |
|
921 | |||
922 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) |
|
922 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) | |
923 | : q_ptr(q), |
|
923 | : q_ptr(q), | |
924 | m_chart(0), |
|
924 | m_chart(0), | |
925 | m_alignment(0), |
|
925 | m_alignment(0), | |
926 | m_orientation(Qt::Orientation(0)), |
|
926 | m_orientation(Qt::Orientation(0)), | |
927 | m_visible(true), |
|
927 | m_visible(true), | |
928 | m_arrowVisible(true), |
|
928 | m_arrowVisible(true), | |
929 | m_axisPen(QChartPrivate::defaultPen()), |
|
929 | m_axisPen(QChartPrivate::defaultPen()), | |
930 | m_axisBrush(QChartPrivate::defaultBrush()), |
|
930 | m_axisBrush(QChartPrivate::defaultBrush()), | |
931 | m_gridLineVisible(true), |
|
931 | m_gridLineVisible(true), | |
932 | m_gridLinePen(QChartPrivate::defaultPen()), |
|
932 | m_gridLinePen(QChartPrivate::defaultPen()), | |
933 | m_minorGridLineVisible(true), |
|
933 | m_minorGridLineVisible(true), | |
934 | m_minorGridLinePen(QChartPrivate::defaultPen()), |
|
934 | m_minorGridLinePen(QChartPrivate::defaultPen()), | |
935 | m_labelsVisible(true), |
|
935 | m_labelsVisible(true), | |
936 | m_labelsBrush(QChartPrivate::defaultBrush()), |
|
936 | m_labelsBrush(QChartPrivate::defaultBrush()), | |
937 | m_labelsFont(QChartPrivate::defaultFont()), |
|
937 | m_labelsFont(QChartPrivate::defaultFont()), | |
938 | m_labelsAngle(0), |
|
938 | m_labelsAngle(0), | |
939 | m_titleVisible(true), |
|
939 | m_titleVisible(true), | |
940 | m_titleBrush(QChartPrivate::defaultBrush()), |
|
940 | m_titleBrush(QChartPrivate::defaultBrush()), | |
941 | m_titleFont(QChartPrivate::defaultFont()), |
|
941 | m_titleFont(QChartPrivate::defaultFont()), | |
942 | m_shadesVisible(false), |
|
942 | m_shadesVisible(false), | |
943 | m_shadesPen(QChartPrivate::defaultPen()), |
|
943 | m_shadesPen(QChartPrivate::defaultPen()), | |
944 | m_shadesBrush(QChartPrivate::defaultBrush()), |
|
944 | m_shadesBrush(QChartPrivate::defaultBrush()), | |
945 | m_shadesOpacity(1.0), |
|
945 | m_shadesOpacity(1.0), | |
946 | m_dirty(false), |
|
946 | m_dirty(false), | |
947 | m_reverse(false) |
|
947 | m_reverse(false) | |
948 | { |
|
948 | { | |
949 | } |
|
949 | } | |
950 |
|
950 | |||
951 | QAbstractAxisPrivate::~QAbstractAxisPrivate() |
|
951 | QAbstractAxisPrivate::~QAbstractAxisPrivate() | |
952 | { |
|
952 | { | |
953 | } |
|
953 | } | |
954 |
|
954 | |||
955 | void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment) |
|
955 | void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment) | |
956 | { |
|
956 | { | |
957 | switch(alignment) { |
|
957 | switch(alignment) { | |
958 | case Qt::AlignTop: |
|
958 | case Qt::AlignTop: | |
959 | case Qt::AlignBottom: |
|
959 | case Qt::AlignBottom: | |
960 | m_orientation = Qt::Horizontal; |
|
960 | m_orientation = Qt::Horizontal; | |
961 | break; |
|
961 | break; | |
962 | case Qt::AlignLeft: |
|
962 | case Qt::AlignLeft: | |
963 | case Qt::AlignRight: |
|
963 | case Qt::AlignRight: | |
964 | m_orientation = Qt::Vertical; |
|
964 | m_orientation = Qt::Vertical; | |
965 | break; |
|
965 | break; | |
966 | default: |
|
966 | default: | |
967 | qWarning()<<"No alignment specified !"; |
|
967 | qWarning()<<"No alignment specified !"; | |
968 | break; |
|
968 | break; | |
969 | }; |
|
969 | }; | |
970 | m_alignment=alignment; |
|
970 | m_alignment=alignment; | |
971 | } |
|
971 | } | |
972 |
|
972 | |||
973 | void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) |
|
973 | void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) | |
974 | { |
|
974 | { | |
975 | if (forced || QChartPrivate::defaultPen() == m_axisPen) |
|
975 | if (forced || QChartPrivate::defaultPen() == m_axisPen) | |
976 | q_ptr->setLinePen(theme->axisLinePen()); |
|
976 | q_ptr->setLinePen(theme->axisLinePen()); | |
977 |
|
977 | |||
978 | if (forced || QChartPrivate::defaultPen() == m_gridLinePen) |
|
978 | if (forced || QChartPrivate::defaultPen() == m_gridLinePen) | |
979 |
q_ptr->setGridLinePen(theme->g |
|
979 | q_ptr->setGridLinePen(theme->gridLinePen()); | |
980 | if (forced || QChartPrivate::defaultPen() == m_minorGridLinePen) |
|
980 | if (forced || QChartPrivate::defaultPen() == m_minorGridLinePen) | |
981 | q_ptr->setMinorGridLinePen(theme->minorGridLinePen()); |
|
981 | q_ptr->setMinorGridLinePen(theme->minorGridLinePen()); | |
982 |
|
982 | |||
983 | if (forced || QChartPrivate::defaultBrush() == m_labelsBrush) |
|
983 | if (forced || QChartPrivate::defaultBrush() == m_labelsBrush) | |
984 | q_ptr->setLabelsBrush(theme->labelBrush()); |
|
984 | q_ptr->setLabelsBrush(theme->labelBrush()); | |
985 | if (forced || QChartPrivate::defaultFont() == m_labelsFont) |
|
985 | if (forced || QChartPrivate::defaultFont() == m_labelsFont) | |
986 | q_ptr->setLabelsFont(theme->labelFont()); |
|
986 | q_ptr->setLabelsFont(theme->labelFont()); | |
987 |
|
987 | |||
988 | if (forced || QChartPrivate::defaultBrush() == m_titleBrush) |
|
988 | if (forced || QChartPrivate::defaultBrush() == m_titleBrush) | |
989 | q_ptr->setTitleBrush(theme->labelBrush()); |
|
989 | q_ptr->setTitleBrush(theme->labelBrush()); | |
990 | if (forced || QChartPrivate::defaultFont() == m_titleFont) { |
|
990 | if (forced || QChartPrivate::defaultFont() == m_titleFont) { | |
991 | QFont font(m_labelsFont); |
|
991 | QFont font(m_labelsFont); | |
992 | font.setBold(true); |
|
992 | font.setBold(true); | |
993 | q_ptr->setTitleFont(font); |
|
993 | q_ptr->setTitleFont(font); | |
994 | } |
|
994 | } | |
995 |
|
995 | |||
996 | if (forced || QChartPrivate::defaultBrush() == m_shadesBrush) |
|
996 | if (forced || QChartPrivate::defaultBrush() == m_shadesBrush) | |
997 | q_ptr->setShadesBrush(theme->backgroundShadesBrush()); |
|
997 | q_ptr->setShadesBrush(theme->backgroundShadesBrush()); | |
998 | if (forced || QChartPrivate::defaultPen() == m_shadesPen) |
|
998 | if (forced || QChartPrivate::defaultPen() == m_shadesPen) | |
999 | q_ptr->setShadesPen(theme->backgroundShadesPen()); |
|
999 | q_ptr->setShadesPen(theme->backgroundShadesPen()); | |
1000 |
|
1000 | |||
1001 | bool axisX = m_orientation == Qt::Horizontal; |
|
1001 | bool axisX = m_orientation == Qt::Horizontal; | |
1002 | if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth |
|
1002 | if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth | |
1003 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX) |
|
1003 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX) | |
1004 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) { |
|
1004 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) { | |
1005 | q_ptr->setShadesVisible(true); |
|
1005 | q_ptr->setShadesVisible(true); | |
1006 | } else if (forced) { |
|
1006 | } else if (forced) { | |
1007 | q_ptr->setShadesVisible(false); |
|
1007 | q_ptr->setShadesVisible(false); | |
1008 | } |
|
1008 | } | |
1009 | } |
|
1009 | } | |
1010 |
|
1010 | |||
1011 | void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max) |
|
1011 | void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max) | |
1012 | { |
|
1012 | { | |
1013 | setRange(min,max); |
|
1013 | setRange(min,max); | |
1014 | } |
|
1014 | } | |
1015 |
|
1015 | |||
1016 | void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent) |
|
1016 | void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent) | |
1017 | { |
|
1017 | { | |
1018 | Q_UNUSED(parent); |
|
1018 | Q_UNUSED(parent); | |
1019 | } |
|
1019 | } | |
1020 |
|
1020 | |||
1021 | void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options) |
|
1021 | void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options) | |
1022 | { |
|
1022 | { | |
1023 | ChartAxisElement *axis = m_item.data(); |
|
1023 | ChartAxisElement *axis = m_item.data(); | |
1024 | Q_ASSERT(axis); |
|
1024 | Q_ASSERT(axis); | |
1025 | if (axis->animation()) |
|
1025 | if (axis->animation()) | |
1026 | axis->animation()->stopAndDestroyLater(); |
|
1026 | axis->animation()->stopAndDestroyLater(); | |
1027 |
|
1027 | |||
1028 | if (options.testFlag(QChart::GridAxisAnimations)) |
|
1028 | if (options.testFlag(QChart::GridAxisAnimations)) | |
1029 | axis->setAnimation(new AxisAnimation(axis)); |
|
1029 | axis->setAnimation(new AxisAnimation(axis)); | |
1030 | else |
|
1030 | else | |
1031 | axis->setAnimation(0); |
|
1031 | axis->setAnimation(0); | |
1032 | } |
|
1032 | } | |
1033 |
|
1033 | |||
1034 |
|
1034 | |||
1035 |
|
1035 | |||
1036 | #include "moc_qabstractaxis.cpp" |
|
1036 | #include "moc_qabstractaxis.cpp" | |
1037 | #include "moc_qabstractaxis_p.cpp" |
|
1037 | #include "moc_qabstractaxis_p.cpp" | |
1038 |
|
1038 | |||
1039 | QT_CHARTS_END_NAMESPACE |
|
1039 | QT_CHARTS_END_NAMESPACE |
@@ -1,93 +1,93 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | // W A R N I N G |
|
19 | // W A R N I N G | |
20 | // ------------- |
|
20 | // ------------- | |
21 | // |
|
21 | // | |
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an |
|
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | |
23 | // implementation detail. This header file may change from version to |
|
23 | // implementation detail. This header file may change from version to | |
24 | // version without notice, or even be removed. |
|
24 | // version without notice, or even be removed. | |
25 | // |
|
25 | // | |
26 | // We mean it. |
|
26 | // We mean it. | |
27 |
|
27 | |||
28 | #ifndef CHARTTHEME_H |
|
28 | #ifndef CHARTTHEME_H | |
29 | #define CHARTTHEME_H |
|
29 | #define CHARTTHEME_H | |
30 |
|
30 | |||
31 | #include <private/chartthememanager_p.h> |
|
31 | #include <private/chartthememanager_p.h> | |
32 | #include <QtGui/QColor> |
|
32 | #include <QtGui/QColor> | |
33 | #include <QtGui/QGradientStops> |
|
33 | #include <QtGui/QGradientStops> | |
34 |
|
34 | |||
35 | QT_CHARTS_BEGIN_NAMESPACE |
|
35 | QT_CHARTS_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class ChartTheme |
|
37 | class ChartTheme | |
38 | { |
|
38 | { | |
39 |
|
39 | |||
40 | public: |
|
40 | public: | |
41 | enum BackgroundShadesMode { |
|
41 | enum BackgroundShadesMode { | |
42 | BackgroundShadesNone = 0, |
|
42 | BackgroundShadesNone = 0, | |
43 | BackgroundShadesVertical, |
|
43 | BackgroundShadesVertical, | |
44 | BackgroundShadesHorizontal, |
|
44 | BackgroundShadesHorizontal, | |
45 | BackgroundShadesBoth |
|
45 | BackgroundShadesBoth | |
46 | }; |
|
46 | }; | |
47 |
|
47 | |||
48 | protected: |
|
48 | protected: | |
49 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id), |
|
49 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id), | |
50 | m_backgroundShadesBrush(Qt::SolidPattern), |
|
50 | m_backgroundShadesBrush(Qt::SolidPattern), | |
51 | m_backgroundShades(BackgroundShadesNone), |
|
51 | m_backgroundShades(BackgroundShadesNone), | |
52 | m_backgroundDropShadowEnabled(false) |
|
52 | m_backgroundDropShadowEnabled(false) | |
53 | {}; |
|
53 | {}; | |
54 | public: |
|
54 | public: | |
55 | QChart::ChartTheme id() const { return m_id; } |
|
55 | QChart::ChartTheme id() const { return m_id; } | |
56 | QList<QGradient> seriesGradients() const { return m_seriesGradients; } |
|
56 | QList<QGradient> seriesGradients() const { return m_seriesGradients; } | |
57 | QList<QColor> seriesColors() const { return m_seriesColors; } |
|
57 | QList<QColor> seriesColors() const { return m_seriesColors; } | |
58 | QLinearGradient chartBackgroundGradient() const { return m_chartBackgroundGradient; } |
|
58 | QLinearGradient chartBackgroundGradient() const { return m_chartBackgroundGradient; } | |
59 | QFont masterFont() const { return m_masterFont; } |
|
59 | QFont masterFont() const { return m_masterFont; } | |
60 | QFont labelFont() const { return m_labelFont; } |
|
60 | QFont labelFont() const { return m_labelFont; } | |
61 | QBrush labelBrush() const { return m_labelBrush; } |
|
61 | QBrush labelBrush() const { return m_labelBrush; } | |
62 | QPen axisLinePen() const { return m_axisLinePen; } |
|
62 | QPen axisLinePen() const { return m_axisLinePen; } | |
63 | QPen backgroundShadesPen() const { return m_backgroundShadesPen; } |
|
63 | QPen backgroundShadesPen() const { return m_backgroundShadesPen; } | |
64 | QPen outlinePen() const { return m_outlinePen; } |
|
64 | QPen outlinePen() const { return m_outlinePen; } | |
65 | QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; } |
|
65 | QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; } | |
66 | BackgroundShadesMode backgroundShades() const { return m_backgroundShades; } |
|
66 | BackgroundShadesMode backgroundShades() const { return m_backgroundShades; } | |
67 | bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; } |
|
67 | bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; } | |
68 |
QPen g |
|
68 | QPen gridLinePen() const { return m_gridLinePen; } | |
69 | QPen minorGridLinePen() const { return m_minorGridLinePen; } |
|
69 | QPen minorGridLinePen() const { return m_minorGridLinePen; } | |
70 |
|
70 | |||
71 | protected: |
|
71 | protected: | |
72 | QChart::ChartTheme m_id; |
|
72 | QChart::ChartTheme m_id; | |
73 | QList<QColor> m_seriesColors; |
|
73 | QList<QColor> m_seriesColors; | |
74 | QList<QGradient> m_seriesGradients; |
|
74 | QList<QGradient> m_seriesGradients; | |
75 | QLinearGradient m_chartBackgroundGradient; |
|
75 | QLinearGradient m_chartBackgroundGradient; | |
76 |
|
76 | |||
77 | QFont m_masterFont; |
|
77 | QFont m_masterFont; | |
78 | QFont m_labelFont; |
|
78 | QFont m_labelFont; | |
79 | QBrush m_labelBrush; |
|
79 | QBrush m_labelBrush; | |
80 | QPen m_axisLinePen; |
|
80 | QPen m_axisLinePen; | |
81 | QPen m_backgroundShadesPen; |
|
81 | QPen m_backgroundShadesPen; | |
82 | QPen m_outlinePen; |
|
82 | QPen m_outlinePen; | |
83 | QBrush m_backgroundShadesBrush; |
|
83 | QBrush m_backgroundShadesBrush; | |
84 | BackgroundShadesMode m_backgroundShades; |
|
84 | BackgroundShadesMode m_backgroundShades; | |
85 | bool m_backgroundDropShadowEnabled; |
|
85 | bool m_backgroundDropShadowEnabled; | |
86 | QPen m_gridLinePen; |
|
86 | QPen m_gridLinePen; | |
87 | QPen m_minorGridLinePen; |
|
87 | QPen m_minorGridLinePen; | |
88 |
|
88 | |||
89 | }; |
|
89 | }; | |
90 |
|
90 | |||
91 | QT_CHARTS_END_NAMESPACE |
|
91 | QT_CHARTS_END_NAMESPACE | |
92 |
|
92 | |||
93 | #endif // CHARTTHEME_H |
|
93 | #endif // CHARTTHEME_H |
General Comments 0
You need to be logged in to leave comments.
Login now