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