##// END OF EJS Templates
Fix for blurred text on error QTRD-1898
Mika Salmela -
r2409:74bee2d758ec
parent child
Show More
@@ -1,1005 +1,1008
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #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 //TODO: remove me
471 //TODO: remove me
472 void QAbstractAxis::setLinePenColor(QColor color)
472 void QAbstractAxis::setLinePenColor(QColor color)
473 {
473 {
474 QPen p = d_ptr->m_axisPen;
474 QPen p = d_ptr->m_axisPen;
475 if (p.color() != color) {
475 if (p.color() != color) {
476 p.setColor(color);
476 p.setColor(color);
477 setLinePen(p);
477 setLinePen(p);
478 emit colorChanged(color);
478 emit colorChanged(color);
479 }
479 }
480 }
480 }
481
481
482 QColor QAbstractAxis::linePenColor() const
482 QColor QAbstractAxis::linePenColor() const
483 {
483 {
484 return d_ptr->m_axisPen.color();
484 return d_ptr->m_axisPen.color();
485 }
485 }
486
486
487 /*!
487 /*!
488 Sets if axis and ticks are \a visible.
488 Sets if axis and ticks are \a visible.
489 */
489 */
490 void QAbstractAxis::setLineVisible(bool visible)
490 void QAbstractAxis::setLineVisible(bool visible)
491 {
491 {
492 if (d_ptr->m_arrowVisible != visible) {
492 if (d_ptr->m_arrowVisible != visible) {
493 d_ptr->m_arrowVisible = visible;
493 d_ptr->m_arrowVisible = visible;
494 emit lineVisibleChanged(visible);
494 emit lineVisibleChanged(visible);
495 }
495 }
496 }
496 }
497
497
498 bool QAbstractAxis::isLineVisible() const
498 bool QAbstractAxis::isLineVisible() const
499 {
499 {
500 return d_ptr->m_arrowVisible;
500 return d_ptr->m_arrowVisible;
501 }
501 }
502
502
503 void QAbstractAxis::setGridLineVisible(bool visible)
503 void QAbstractAxis::setGridLineVisible(bool visible)
504 {
504 {
505 if (d_ptr->m_gridLineVisible != visible) {
505 if (d_ptr->m_gridLineVisible != visible) {
506 d_ptr->m_gridLineVisible = visible;
506 d_ptr->m_gridLineVisible = visible;
507 emit gridVisibleChanged(visible);
507 emit gridVisibleChanged(visible);
508 }
508 }
509 }
509 }
510
510
511 bool QAbstractAxis::isGridLineVisible() const
511 bool QAbstractAxis::isGridLineVisible() const
512 {
512 {
513 return d_ptr->m_gridLineVisible;
513 return d_ptr->m_gridLineVisible;
514 }
514 }
515
515
516 /*!
516 /*!
517 Sets \a pen used to draw grid line.
517 Sets \a pen used to draw grid line.
518 */
518 */
519 void QAbstractAxis::setGridLinePen(const QPen &pen)
519 void QAbstractAxis::setGridLinePen(const QPen &pen)
520 {
520 {
521 if (d_ptr->m_gridLinePen != pen) {
521 if (d_ptr->m_gridLinePen != pen) {
522 d_ptr->m_gridLinePen = pen;
522 d_ptr->m_gridLinePen = pen;
523 emit gridLinePenChanged(pen);
523 emit gridLinePenChanged(pen);
524 }
524 }
525 }
525 }
526
526
527 /*!
527 /*!
528 Returns pen used to draw grid.
528 Returns pen used to draw grid.
529 */
529 */
530 QPen QAbstractAxis::gridLinePen() const
530 QPen QAbstractAxis::gridLinePen() const
531 {
531 {
532 return d_ptr->m_gridLinePen;
532 return d_ptr->m_gridLinePen;
533 }
533 }
534
534
535 void QAbstractAxis::setLabelsVisible(bool visible)
535 void QAbstractAxis::setLabelsVisible(bool visible)
536 {
536 {
537 if (d_ptr->m_labelsVisible != visible) {
537 if (d_ptr->m_labelsVisible != visible) {
538 d_ptr->m_labelsVisible = visible;
538 d_ptr->m_labelsVisible = visible;
539 emit labelsVisibleChanged(visible);
539 emit labelsVisibleChanged(visible);
540 }
540 }
541 }
541 }
542
542
543 bool QAbstractAxis::labelsVisible() const
543 bool QAbstractAxis::labelsVisible() const
544 {
544 {
545 return d_ptr->m_labelsVisible;
545 return d_ptr->m_labelsVisible;
546 }
546 }
547
547
548 /*!
548 /*!
549 Sets \a pen used to draw labels.
549 Sets \a pen used to draw labels.
550 */
550 */
551 void QAbstractAxis::setLabelsPen(const QPen &pen)
551 void QAbstractAxis::setLabelsPen(const QPen &pen)
552 {
552 {
553 if (d_ptr->m_labelsPen != pen) {
553 if (d_ptr->m_labelsPen != pen) {
554 d_ptr->m_labelsPen = pen;
554 d_ptr->m_labelsPen = pen;
555 emit labelsPenChanged(pen);
555 emit labelsPenChanged(pen);
556 }
556 }
557 }
557 }
558
558
559 /*!
559 /*!
560 Returns the pen used to labels.
560 Returns the pen used to labels.
561 */
561 */
562 QPen QAbstractAxis::labelsPen() const
562 QPen QAbstractAxis::labelsPen() const
563 {
563 {
564 return d_ptr->m_labelsPen;
564 return d_ptr->m_labelsPen;
565 }
565 }
566
566
567 /*!
567 /*!
568 Sets \a brush used to draw labels.
568 Sets \a brush used to draw labels.
569 */
569 */
570 void QAbstractAxis::setLabelsBrush(const QBrush &brush)
570 void QAbstractAxis::setLabelsBrush(const QBrush &brush)
571 {
571 {
572 if (d_ptr->m_labelsBrush != brush) {
572 if (d_ptr->m_labelsBrush != brush) {
573 d_ptr->m_labelsBrush = brush;
573 d_ptr->m_labelsBrush = brush;
574 emit labelsBrushChanged(brush);
574 emit labelsBrushChanged(brush);
575 }
575 }
576 }
576 }
577
577
578 /*!
578 /*!
579 Returns brush used to draw labels.
579 Returns brush used to draw labels.
580 */
580 */
581 QBrush QAbstractAxis::labelsBrush() const
581 QBrush QAbstractAxis::labelsBrush() const
582 {
582 {
583 return d_ptr->m_labelsBrush;
583 return d_ptr->m_labelsBrush;
584 }
584 }
585
585
586 /*!
586 /*!
587 Sets \a font used to draw labels.
587 Sets \a font used to draw labels.
588 */
588 */
589 void QAbstractAxis::setLabelsFont(const QFont &font)
589 void QAbstractAxis::setLabelsFont(const QFont &font)
590 {
590 {
591 if (d_ptr->m_labelsFont != font) {
591 if (d_ptr->m_labelsFont != font) {
592 d_ptr->m_labelsFont = font;
592 d_ptr->m_labelsFont = font;
593 emit labelsFontChanged(font);
593 emit labelsFontChanged(font);
594 }
594 }
595 }
595 }
596
596
597 /*!
597 /*!
598 Returns font used to draw labels.
598 Returns font used to draw labels.
599 */
599 */
600 QFont QAbstractAxis::labelsFont() const
600 QFont QAbstractAxis::labelsFont() const
601 {
601 {
602 return d_ptr->m_labelsFont;
602 return d_ptr->m_labelsFont;
603 }
603 }
604
604
605 void QAbstractAxis::setLabelsAngle(int angle)
605 void QAbstractAxis::setLabelsAngle(int angle)
606 {
606 {
607 if (d_ptr->m_labelsAngle != angle) {
607 if (d_ptr->m_labelsAngle != angle) {
608 d_ptr->m_labelsAngle = angle;
608 d_ptr->m_labelsAngle = angle;
609 emit labelsAngleChanged(angle);
609 emit labelsAngleChanged(angle);
610 }
610 }
611 }
611 }
612
612
613 int QAbstractAxis::labelsAngle() const
613 int QAbstractAxis::labelsAngle() const
614 {
614 {
615 return d_ptr->m_labelsAngle;
615 return d_ptr->m_labelsAngle;
616 }
616 }
617 //TODO: remove me
617 //TODO: remove me
618 void QAbstractAxis::setLabelsColor(QColor color)
618 void QAbstractAxis::setLabelsColor(QColor color)
619 {
619 {
620 QBrush b = d_ptr->m_labelsBrush;
620 QBrush b = d_ptr->m_labelsBrush;
621 if (b.color() != color) {
621 if (b.color() != color) {
622 b.setColor(color);
622 b.setColor(color);
623 setLabelsBrush(b);
623 setLabelsBrush(b);
624 emit labelsColorChanged(color);
624 emit labelsColorChanged(color);
625 }
625 }
626 }
626 }
627
627
628 QColor QAbstractAxis::labelsColor() const
628 QColor QAbstractAxis::labelsColor() const
629 {
629 {
630 return d_ptr->m_labelsBrush.color();
630 return d_ptr->m_labelsBrush.color();
631 }
631 }
632
632
633 void QAbstractAxis::setTitleVisible(bool visible)
633 void QAbstractAxis::setTitleVisible(bool visible)
634 {
634 {
635 if (d_ptr->m_titleVisible != visible) {
635 if (d_ptr->m_titleVisible != visible) {
636 d_ptr->m_titleVisible = visible;
636 d_ptr->m_titleVisible = visible;
637 emit titleVisibleChanged(visible);
637 emit titleVisibleChanged(visible);
638 }
638 }
639 }
639 }
640
640
641 bool QAbstractAxis::isTitleVisible() const
641 bool QAbstractAxis::isTitleVisible() const
642 {
642 {
643 return d_ptr->m_titleVisible;
643 return d_ptr->m_titleVisible;
644 }
644 }
645
645
646 /*!
646 /*!
647 Sets \a pen used to draw title.
647 Sets \a pen used to draw title.
648 */
648 */
649 void QAbstractAxis::setTitlePen(const QPen &pen)
649 void QAbstractAxis::setTitlePen(const QPen &pen)
650 {
650 {
651 if (d_ptr->m_titlePen != pen) {
651 if (d_ptr->m_titlePen != pen) {
652 d_ptr->m_titlePen = pen;
652 d_ptr->m_titlePen = pen;
653 emit titlePenChanged(pen);
653 emit titlePenChanged(pen);
654 }
654 }
655 }
655 }
656
656
657 /*!
657 /*!
658 Returns the pen used to title.
658 Returns the pen used to title.
659 */
659 */
660 QPen QAbstractAxis::titlePen() const
660 QPen QAbstractAxis::titlePen() const
661 {
661 {
662 return d_ptr->m_titlePen;
662 return d_ptr->m_titlePen;
663 }
663 }
664
664
665 /*!
665 /*!
666 Sets \a brush used to draw title.
666 Sets \a brush used to draw title.
667 */
667 */
668 void QAbstractAxis::setTitleBrush(const QBrush &brush)
668 void QAbstractAxis::setTitleBrush(const QBrush &brush)
669 {
669 {
670 if (d_ptr->m_titleBrush != brush) {
670 if (d_ptr->m_titleBrush != brush) {
671 d_ptr->m_titleBrush = brush;
671 d_ptr->m_titleBrush = brush;
672 emit titleBrushChanged(brush);
672 emit titleBrushChanged(brush);
673 }
673 }
674 }
674 }
675
675
676 /*!
676 /*!
677 Returns brush used to draw title.
677 Returns brush used to draw title.
678 */
678 */
679 QBrush QAbstractAxis::titleBrush() const
679 QBrush QAbstractAxis::titleBrush() const
680 {
680 {
681 return d_ptr->m_titleBrush;
681 return d_ptr->m_titleBrush;
682 }
682 }
683
683
684 /*!
684 /*!
685 Sets \a font used to draw title.
685 Sets \a font used to draw title.
686 */
686 */
687 void QAbstractAxis::setTitleFont(const QFont &font)
687 void QAbstractAxis::setTitleFont(const QFont &font)
688 {
688 {
689 if (d_ptr->m_titleFont != font) {
689 if (d_ptr->m_titleFont != font) {
690 d_ptr->m_titleFont = font;
690 d_ptr->m_titleFont = font;
691 emit titleFontChanged(font);
691 emit titleFontChanged(font);
692 }
692 }
693 }
693 }
694
694
695 /*!
695 /*!
696 Returns font used to draw title.
696 Returns font used to draw title.
697 */
697 */
698 QFont QAbstractAxis::titleFont() const
698 QFont QAbstractAxis::titleFont() const
699 {
699 {
700 return d_ptr->m_titleFont;
700 return d_ptr->m_titleFont;
701 }
701 }
702
702
703 void QAbstractAxis::setTitleText(const QString &title)
703 void QAbstractAxis::setTitleText(const QString &title)
704 {
704 {
705 if (d_ptr->m_title != title) {
705 if (d_ptr->m_title != title) {
706 d_ptr->m_title = title;
706 d_ptr->m_title = title;
707 emit titleTextChanged(title);
707 emit titleTextChanged(title);
708 }
708 }
709 }
709 }
710
710
711 QString QAbstractAxis::titleText() const
711 QString QAbstractAxis::titleText() const
712 {
712 {
713 return d_ptr->m_title;
713 return d_ptr->m_title;
714 }
714 }
715
715
716
716
717 void QAbstractAxis::setShadesVisible(bool visible)
717 void QAbstractAxis::setShadesVisible(bool visible)
718 {
718 {
719 if (d_ptr->m_shadesVisible != visible) {
719 if (d_ptr->m_shadesVisible != visible) {
720 d_ptr->m_shadesVisible = visible;
720 d_ptr->m_shadesVisible = visible;
721 emit shadesVisibleChanged(visible);
721 emit shadesVisibleChanged(visible);
722 }
722 }
723 }
723 }
724
724
725 bool QAbstractAxis::shadesVisible() const
725 bool QAbstractAxis::shadesVisible() const
726 {
726 {
727 return d_ptr->m_shadesVisible;
727 return d_ptr->m_shadesVisible;
728 }
728 }
729
729
730 /*!
730 /*!
731 Sets \a pen used to draw shades.
731 Sets \a pen used to draw shades.
732 */
732 */
733 void QAbstractAxis::setShadesPen(const QPen &pen)
733 void QAbstractAxis::setShadesPen(const QPen &pen)
734 {
734 {
735 if (d_ptr->m_shadesPen != pen) {
735 if (d_ptr->m_shadesPen != pen) {
736 d_ptr->m_shadesPen = pen;
736 d_ptr->m_shadesPen = pen;
737 emit shadesPenChanged(pen);
737 emit shadesPenChanged(pen);
738 }
738 }
739 }
739 }
740
740
741 /*!
741 /*!
742 Returns pen used to draw shades.
742 Returns pen used to draw shades.
743 */
743 */
744 QPen QAbstractAxis::shadesPen() const
744 QPen QAbstractAxis::shadesPen() const
745 {
745 {
746 return d_ptr->m_shadesPen;
746 return d_ptr->m_shadesPen;
747 }
747 }
748
748
749 /*!
749 /*!
750 Sets \a brush used to draw shades.
750 Sets \a brush used to draw shades.
751 */
751 */
752 void QAbstractAxis::setShadesBrush(const QBrush &brush)
752 void QAbstractAxis::setShadesBrush(const QBrush &brush)
753 {
753 {
754 if (d_ptr->m_shadesBrush != brush) {
754 if (d_ptr->m_shadesBrush != brush) {
755 d_ptr->m_shadesBrush = brush;
755 d_ptr->m_shadesBrush = brush;
756 emit shadesBrushChanged(brush);
756 emit shadesBrushChanged(brush);
757 }
757 }
758 }
758 }
759
759
760 /*!
760 /*!
761 Returns brush used to draw shades.
761 Returns brush used to draw shades.
762 */
762 */
763 QBrush QAbstractAxis::shadesBrush() const
763 QBrush QAbstractAxis::shadesBrush() const
764 {
764 {
765 return d_ptr->m_shadesBrush;
765 return d_ptr->m_shadesBrush;
766 }
766 }
767
767
768 void QAbstractAxis::setShadesColor(QColor color)
768 void QAbstractAxis::setShadesColor(QColor color)
769 {
769 {
770 QBrush b = d_ptr->m_shadesBrush;
770 QBrush b = d_ptr->m_shadesBrush;
771 if (b.color() != color) {
771 if (b.color() != color) {
772 b.setColor(color);
772 b.setColor(color);
773 setShadesBrush(b);
773 setShadesBrush(b);
774 emit shadesColorChanged(color);
774 emit shadesColorChanged(color);
775 }
775 }
776 }
776 }
777
777
778 QColor QAbstractAxis::shadesColor() const
778 QColor QAbstractAxis::shadesColor() const
779 {
779 {
780 return d_ptr->m_shadesBrush.color();
780 return d_ptr->m_shadesBrush.color();
781 }
781 }
782
782
783 void QAbstractAxis::setShadesBorderColor(QColor color)
783 void QAbstractAxis::setShadesBorderColor(QColor color)
784 {
784 {
785 QPen p = d_ptr->m_shadesPen;
785 QPen p = d_ptr->m_shadesPen;
786 if (p.color() != color) {
786 if (p.color() != color) {
787 p.setColor(color);
787 p.setColor(color);
788 setShadesPen(p);
788 setShadesPen(p);
789 emit shadesColorChanged(color);
789 emit shadesColorChanged(color);
790 }
790 }
791 }
791 }
792
792
793 QColor QAbstractAxis::shadesBorderColor() const
793 QColor QAbstractAxis::shadesBorderColor() const
794 {
794 {
795 return d_ptr->m_shadesPen.color();
795 return d_ptr->m_shadesPen.color();
796 }
796 }
797
797
798
798
799 bool QAbstractAxis::isVisible() const
799 bool QAbstractAxis::isVisible() const
800 {
800 {
801 return d_ptr->m_visible;
801 return d_ptr->m_visible;
802 }
802 }
803
803
804 /*!
804 /*!
805 Sets axis, shades, labels and grid lines to be visible.
805 Sets axis, shades, labels and grid lines to be visible.
806 */
806 */
807 void QAbstractAxis::setVisible(bool visible)
807 void QAbstractAxis::setVisible(bool visible)
808 {
808 {
809 if (d_ptr->m_visible != visible) {
809 if (d_ptr->m_visible != visible) {
810 d_ptr->m_visible = visible;
810 d_ptr->m_visible = visible;
811 emit visibleChanged(visible);
811 emit visibleChanged(visible);
812 }
812 }
813 }
813 }
814
814
815
815
816 /*!
816 /*!
817 Sets axis, shades, labels and grid lines to be visible.
817 Sets axis, shades, labels and grid lines to be visible.
818 */
818 */
819 void QAbstractAxis::show()
819 void QAbstractAxis::show()
820 {
820 {
821 setVisible(true);
821 setVisible(true);
822 }
822 }
823
823
824 /*!
824 /*!
825 Sets axis, shades, labels and grid lines to not be visible.
825 Sets axis, shades, labels and grid lines to not be visible.
826 */
826 */
827 void QAbstractAxis::hide()
827 void QAbstractAxis::hide()
828 {
828 {
829 setVisible(false);
829 setVisible(false);
830 }
830 }
831
831
832 /*!
832 /*!
833 Sets the minimum value shown on the axis.
833 Sets the minimum value shown on the axis.
834 Depending on the actual axis type the \a min parameter is converted to appropriate type.
834 Depending on the actual axis type the \a min parameter is converted to appropriate type.
835 If the conversion is impossible then the function call does nothing
835 If the conversion is impossible then the function call does nothing
836 */
836 */
837 void QAbstractAxis::setMin(const QVariant &min)
837 void QAbstractAxis::setMin(const QVariant &min)
838 {
838 {
839 d_ptr->setMin(min);
839 d_ptr->setMin(min);
840 }
840 }
841
841
842 /*!
842 /*!
843 Sets the maximum value shown on the axis.
843 Sets the maximum value shown on the axis.
844 Depending on the actual axis type the \a max parameter is converted to appropriate type.
844 Depending on the actual axis type the \a max parameter is converted to appropriate type.
845 If the conversion is impossible then the function call does nothing
845 If the conversion is impossible then the function call does nothing
846 */
846 */
847 void QAbstractAxis::setMax(const QVariant &max)
847 void QAbstractAxis::setMax(const QVariant &max)
848 {
848 {
849 d_ptr->setMax(max);
849 d_ptr->setMax(max);
850 }
850 }
851
851
852 /*!
852 /*!
853 Sets the range shown on the axis.
853 Sets the range shown on the axis.
854 Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types.
854 Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types.
855 If the conversion is impossible then the function call does nothing.
855 If the conversion is impossible then the function call does nothing.
856 */
856 */
857 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
857 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
858 {
858 {
859 d_ptr->setRange(min, max);
859 d_ptr->setRange(min, max);
860 }
860 }
861
861
862
862
863 /*!
863 /*!
864 Returns the orientation in which the axis is being used (Vertical or Horizontal)
864 Returns the orientation in which the axis is being used (Vertical or Horizontal)
865 */
865 */
866 // NOTE: should have const but it breaks BC:
866 // NOTE: should have const but it breaks BC:
867 // http://techbase.kde.org/Policies/Binary_Compatibility_Examples#Change_the_CV-qualifiers_of_a_member_function
867 // http://techbase.kde.org/Policies/Binary_Compatibility_Examples#Change_the_CV-qualifiers_of_a_member_function
868 Qt::Orientation QAbstractAxis::orientation()
868 Qt::Orientation QAbstractAxis::orientation()
869 {
869 {
870 return d_ptr->orientation();
870 return d_ptr->orientation();
871 }
871 }
872
872
873 Qt::Alignment QAbstractAxis::alignment() const
873 Qt::Alignment QAbstractAxis::alignment() const
874 {
874 {
875 return d_ptr->alignment();
875 return d_ptr->alignment();
876 }
876 }
877
877
878 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
878 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
879
879
880 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q)
880 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q)
881 : q_ptr(q),
881 : q_ptr(q),
882 m_chart(0),
882 m_chart(0),
883 m_alignment(0),
883 m_alignment(0),
884 m_orientation(Qt::Orientation(0)),
884 m_orientation(Qt::Orientation(0)),
885 m_visible(true),
885 m_visible(true),
886 m_arrowVisible(true),
886 m_arrowVisible(true),
887 m_gridLineVisible(true),
887 m_gridLineVisible(true),
888 m_labelsVisible(true),
888 m_labelsVisible(true),
889 m_labelsAngle(0),
889 m_labelsAngle(0),
890 m_titleVisible(true),
890 m_titleVisible(true),
891 m_shadesVisible(false),
891 m_shadesVisible(false),
892 m_shadesBrush(Qt::SolidPattern),
892 m_shadesBrush(Qt::SolidPattern),
893 m_shadesOpacity(1.0),
893 m_shadesOpacity(1.0),
894 m_dirty(false)
894 m_dirty(false)
895 {
895 {
896
896
897 }
897 }
898
898
899 QAbstractAxisPrivate::~QAbstractAxisPrivate()
899 QAbstractAxisPrivate::~QAbstractAxisPrivate()
900 {
900 {
901 }
901 }
902
902
903 void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment)
903 void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment)
904 {
904 {
905 switch(alignment) {
905 switch(alignment) {
906 case Qt::AlignTop:
906 case Qt::AlignTop:
907 case Qt::AlignBottom:
907 case Qt::AlignBottom:
908 m_orientation = Qt::Horizontal;
908 m_orientation = Qt::Horizontal;
909 break;
909 break;
910 case Qt::AlignLeft:
910 case Qt::AlignLeft:
911 case Qt::AlignRight:
911 case Qt::AlignRight:
912 m_orientation = Qt::Vertical;
912 m_orientation = Qt::Vertical;
913 break;
913 break;
914 default:
914 default:
915 qWarning()<<"No alignment specified !";
915 qWarning()<<"No alignment specified !";
916 break;
916 break;
917 };
917 };
918 m_alignment=alignment;
918 m_alignment=alignment;
919 }
919 }
920
920
921 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
921 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
922 {
922 {
923 QPen pen;
923 QPen pen;
924 QBrush brush;
924 QBrush brush;
925 QFont font;
925 QFont font;
926
926
927 bool axisX = m_orientation == Qt::Horizontal;
927 bool axisX = m_orientation == Qt::Horizontal;
928
928
929 if (m_arrowVisible) {
929 //TODO: introduce axis brush
930
930 if (m_visible) {
931 if (forced || brush == m_labelsBrush){
931 if (m_arrowVisible) {
932 q_ptr->setLabelsBrush(theme->labelBrush());
932 if (forced || pen == m_axisPen) {
933 q_ptr->setLinePen(theme->axisLinePen());
934 }
933 }
935 }
934 //TODO: introduce axis brush
936 if (m_gridLineVisible) {
935 if (forced || brush == m_titleBrush){
937 if (forced || pen == m_gridLinePen) {
936 q_ptr->setTitleBrush(theme->labelBrush());
938 q_ptr->setGridLinePen(theme->girdLinePen());
939 }
937 }
940 }
938 if (forced || pen == m_labelsPen){
941 if (m_labelsVisible) {
939 q_ptr->setLabelsPen(Qt::NoPen);// NoPen for performance reasons
942 if (forced || brush == m_labelsBrush){
943 q_ptr->setLabelsBrush(theme->labelBrush());
944 }
945 if (forced || pen == m_labelsPen){
946 q_ptr->setLabelsPen(Qt::NoPen);// NoPen for performance reasons
947 }
948 if (forced || font == m_labelsFont){
949 q_ptr->setLabelsFont(theme->labelFont());
950 }
940 }
951 }
941 if (forced || pen == m_titlePen){
952 if (m_titleVisible) {
942 q_ptr->setTitlePen(Qt::NoPen);// Noen for performance reasons
953 if (forced || brush == m_titleBrush){
954 q_ptr->setTitleBrush(theme->labelBrush());
955 }
956 if (forced || pen == m_titlePen){
957 q_ptr->setTitlePen(Qt::NoPen);// Noen for performance reasons
958 }
959 //TODO: discuss with Tero
960 if (forced || font == m_titleFont){
961 QFont font(m_labelsFont);
962 font.setBold(true);
963 q_ptr->setTitleFont(font);
964 }
943 }
965 }
944 if (forced || m_shadesVisible) {
966 if (forced || m_shadesVisible) {
945
946 if (forced || brush == m_shadesBrush){
967 if (forced || brush == m_shadesBrush){
947 q_ptr->setShadesBrush(theme->backgroundShadesBrush());
968 q_ptr->setShadesBrush(theme->backgroundShadesBrush());
948 }
969 }
949 if (forced || pen == m_shadesPen){
970 if (forced || pen == m_shadesPen){
950 q_ptr->setShadesPen(theme->backgroundShadesPen());
971 q_ptr->setShadesPen(theme->backgroundShadesPen());
951 }
972 }
952 if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth
973 if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth
953 || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX)
974 || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX)
954 || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) {
975 || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) {
955 q_ptr->setShadesVisible(true);
976 q_ptr->setShadesVisible(true);
956 }
977 }
957 }
978 }
958
959 if (forced || pen == m_axisPen) {
960 q_ptr->setLinePen(theme->axisLinePen());
961 }
962
963 if (forced || pen == m_gridLinePen) {
964 q_ptr->setGridLinePen(theme->girdLinePen());
965 }
966
967 if (forced || font == m_labelsFont){
968 q_ptr->setLabelsFont(theme->labelFont());
969 }
970 //TODO: discuss with Tero
971 if (forced || font == m_titleFont){
972 QFont font(m_labelsFont);
973 font.setBold(true);
974 q_ptr->setTitleFont(font);
975 }
976 }
979 }
977 }
980 }
978
981
979 void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max)
982 void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max)
980 {
983 {
981 setRange(min,max);
984 setRange(min,max);
982 }
985 }
983
986
984 void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent)
987 void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent)
985 {
988 {
986 Q_UNUSED(parent);
989 Q_UNUSED(parent);
987 }
990 }
988
991
989 void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options)
992 void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options)
990 {
993 {
991 ChartAxis* axis = m_item.data();
994 ChartAxis* axis = m_item.data();
992 Q_ASSERT(axis);
995 Q_ASSERT(axis);
993 if(options.testFlag(QChart::GridAxisAnimations)) {
996 if(options.testFlag(QChart::GridAxisAnimations)) {
994 axis->setAnimation(new AxisAnimation(axis));
997 axis->setAnimation(new AxisAnimation(axis));
995 }else{
998 }else{
996 axis->setAnimation(0);
999 axis->setAnimation(0);
997 }
1000 }
998 }
1001 }
999
1002
1000
1003
1001
1004
1002 #include "moc_qabstractaxis.cpp"
1005 #include "moc_qabstractaxis.cpp"
1003 #include "moc_qabstractaxis_p.cpp"
1006 #include "moc_qabstractaxis_p.cpp"
1004
1007
1005 QTCOMMERCIALCHART_END_NAMESPACE
1008 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now