##// END OF EJS Templates
QAbstractAxis: docs fixes
Marek Rosa -
r1848:893302d52d66
parent child
Show More
@@ -1,658 +1,658
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
23
24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25
25
26 /*!
26 /*!
27 \class QAbstractAxis
27 \class QAbstractAxis
28 \brief The QAbstractAxis class is used for manipulating chart's axis.
28 \brief The QAbstractAxis class is used for manipulating chart's axis.
29 \mainclass
29 \mainclass
30
30
31 There is only one x Axis visible at the time, however there can be multiple y axes.
31 There is only one x Axis visible at the time, however there can be multiple y axes.
32 Each chart series can be bound to exactly one Y axis and the shared common X axis.
32 Each chart series can be bound to exactly one Y axis and the shared common X axis.
33 Axis can be setup to show axis line with tick marks, grid lines and shades.
33 Axis can be setup to show axis line with tick marks, grid lines and shades.
34 */
34 */
35
35
36 /*!
36 /*!
37 \qmlclass AbstractAxis QAbstractAxis
37 \qmlclass AbstractAxis QAbstractAxis
38 \brief The Axis element is used for manipulating chart's axes
38 \brief The Axis element is used for manipulating chart's axes
39
39
40 There is only one x Axis visible at the time, however there can be multiple y axes on a ChartView.
40 There is only one x Axis visible at the time, however there can be multiple y axes on a ChartView.
41 Each chart series can be bound to exactly one Y axis and the shared common X axis.
41 Each chart series can be bound to exactly one Y axis and the shared common X axis.
42 Axis can be setup to show axis line with tick marks, grid lines and shades.
42 Axis can be setup to show axis line with tick marks, grid lines and shades.
43
43
44 To access Axes you can use ChartView API. For example:
44 To access Axes you can use ChartView API. For example:
45 \code
45 \code
46 ChartView {
46 ChartView {
47 axisX.min: 0
47 axisX.min: 0
48 axisX.max: 3
48 axisX.max: 3
49 axisX.ticksCount: 4
49 axisX.ticksCount: 4
50 axisY.min: 0
50 axisY.min: 0
51 axisY.max: 4
51 axisY.max: 4
52 // Add a few series...
52 // Add a few series...
53 }
53 }
54 \endcode
54 \endcode
55 */
55 */
56
56
57 /*!
57 /*!
58 \enum QAbstractAxis::AxisType
58 \enum QAbstractAxis::AxisType
59
59
60 The type of the series object.
60 The type of the series object.
61
61
62 \value AxisTypeNoAxis
62 \value AxisTypeNoAxis
63 \value AxisTypeValue
63 \value AxisTypeValue
64 \value AxisTypeBarCategory
64 \value AxisTypeBarCategory
65 \value AxisTypeCategory
65 \value AxisTypeCategory
66 \value AxisTypeDateTime
66 \value AxisTypeDateTime
67 */
67 */
68
68
69 /*!
69 /*!
70 *\fn void QAbstractAxis::type() const
70 *\fn void QAbstractAxis::type() const
71 Returns the type of the axis
71 Returns the type of the axis
72 */
72 */
73
73
74 /*!
74 /*!
75 \property QAbstractAxis::arrowVisible
75 \property QAbstractAxis::lineVisible
76 The visibility of the axis arrow
76 The visibility of the axis line
77 */
77 */
78 /*!
78 /*!
79 \qmlproperty bool AbstractAxis::arrrowVisible
79 \qmlproperty bool AbstractAxis::lineVisible
80 The visibility of the axis arrow
80 The visibility of the axis line
81 */
81 */
82
82
83 /*!
83 /*!
84 \property QAbstractAxis::labelsVisible
84 \property QAbstractAxis::labelsVisible
85 Defines if axis labels are visible.
85 Defines if axis labels are visible.
86 */
86 */
87 /*!
87 /*!
88 \qmlproperty bool AbstractAxis::labelsVisible
88 \qmlproperty bool AbstractAxis::labelsVisible
89 Defines if axis labels are visible.
89 Defines if axis labels are visible.
90 */
90 */
91
91
92 /*!
92 /*!
93 \property QAbstractAxis::visible
93 \property QAbstractAxis::visible
94 The visibility of the axis.
94 The visibility of the axis.
95 */
95 */
96 /*!
96 /*!
97 \qmlproperty bool AbstractAxis::visible
97 \qmlproperty bool AbstractAxis::visible
98 The visibility of the axis.
98 The visibility of the axis.
99 */
99 */
100
100
101 /*!
101 /*!
102 \property QAbstractAxis::gridVisible
102 \property QAbstractAxis::gridVisible
103 The visibility of the grid lines.
103 The visibility of the grid lines.
104 */
104 */
105 /*!
105 /*!
106 \qmlproperty bool AbstractAxis::gridVisible
106 \qmlproperty bool AbstractAxis::gridVisible
107 The visibility of the grid lines.
107 The visibility of the grid lines.
108 */
108 */
109
109
110 /*!
110 /*!
111 \property QAbstractAxis::color
111 \property QAbstractAxis::color
112 The color of the axis and ticks.
112 The color of the axis and ticks.
113 */
113 */
114 /*!
114 /*!
115 \qmlproperty color AbstractAxis::color
115 \qmlproperty color AbstractAxis::color
116 The color of the axis and ticks.
116 The color of the axis and ticks.
117 */
117 */
118
118
119 /*!
119 /*!
120 \property QAbstractAxis::labelsFont
120 \property QAbstractAxis::labelsFont
121 The font of the axis labels.
121 The font of the axis labels.
122 */
122 */
123
123
124 /*!
124 /*!
125 \qmlproperty Font AbstractAxis::labelsFont
125 \qmlproperty Font AbstractAxis::labelsFont
126 The font of the axis labels.
126 The font of the axis labels.
127
127
128 See the \l {Font} {QML Font Element} for detailed documentation.
128 See the \l {Font} {QML Font Element} for detailed documentation.
129 */
129 */
130
130
131 /*!
131 /*!
132 \property QAbstractAxis::labelsColor
132 \property QAbstractAxis::labelsColor
133 The color of the axis labels.
133 The color of the axis labels.
134 */
134 */
135 /*!
135 /*!
136 \qmlproperty color AbstractAxis::labelsColor
136 \qmlproperty color AbstractAxis::labelsColor
137 The color of the axis labels.
137 The color of the axis labels.
138 */
138 */
139
139
140 /*!
140 /*!
141 \property QAbstractAxis::labelsAngle
141 \property QAbstractAxis::labelsAngle
142 The angle of the axis labels in degrees.
142 The angle of the axis labels in degrees.
143 */
143 */
144 /*!
144 /*!
145 \qmlproperty int AbstractAxis::labelsAngle
145 \qmlproperty int AbstractAxis::labelsAngle
146 The angle of the axis labels in degrees.
146 The angle of the axis labels in degrees.
147 */
147 */
148
148
149 /*!
149 /*!
150 \property QAbstractAxis::shadesVisible
150 \property QAbstractAxis::shadesVisible
151 The visibility of the axis shades.
151 The visibility of the axis shades.
152 */
152 */
153 /*!
153 /*!
154 \qmlproperty bool AbstractAxis::shadesVisible
154 \qmlproperty bool AbstractAxis::shadesVisible
155 The visibility of the axis shades.
155 The visibility of the axis shades.
156 */
156 */
157
157
158 /*!
158 /*!
159 \property QAbstractAxis::shadesColor
159 \property QAbstractAxis::shadesColor
160 The fill (brush) color of the axis shades.
160 The fill (brush) color of the axis shades.
161 */
161 */
162 /*!
162 /*!
163 \qmlproperty color AbstractAxis::shadesColor
163 \qmlproperty color AbstractAxis::shadesColor
164 The fill (brush) color of the axis shades.
164 The fill (brush) color of the axis shades.
165 */
165 */
166
166
167 /*!
167 /*!
168 \property QAbstractAxis::shadesBorderColor
168 \property QAbstractAxis::shadesBorderColor
169 The border (pen) color of the axis shades.
169 The border (pen) color of the axis shades.
170 */
170 */
171 /*!
171 /*!
172 \qmlproperty color AbstractAxis::shadesBorderColor
172 \qmlproperty color AbstractAxis::shadesBorderColor
173 The border (pen) color of the axis shades.
173 The border (pen) color of the axis shades.
174 */
174 */
175
175
176 /*!
176 /*!
177 \fn void QAbstractAxis::visibleChanged(bool visible)
177 \fn void QAbstractAxis::visibleChanged(bool visible)
178 Visiblity of the axis has changed to \a visible.
178 Visiblity of the axis has changed to \a visible.
179 */
179 */
180 /*!
180 /*!
181 \qmlsignal AbstractAxis::onVisibleChanged(bool visible)
181 \qmlsignal AbstractAxis::onVisibleChanged(bool visible)
182 Visiblity of the axis has changed to \a visible.
182 Visiblity of the axis has changed to \a visible.
183 */
183 */
184
184
185 /*!
185 /*!
186 \fn void QAbstractAxis::arrowVisibleChanged(bool visible)
186 \fn void QAbstractAxis::lineVisibleChanged(bool visible)
187 Visiblity of the axis arrow has changed to \a visible.
187 Visiblity of the axis line has changed to \a visible.
188 */
188 */
189 /*!
189 /*!
190 \qmlsignal AbstractAxis::onArrowVisibleChanged(bool visible)
190 \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible)
191 Visiblity of the axis arrow has changed to \a visible.
191 Visiblity of the axis line has changed to \a visible.
192 */
192 */
193
193
194 /*!
194 /*!
195 \fn void QAbstractAxis::labelsVisibleChanged(bool visible)
195 \fn void QAbstractAxis::labelsVisibleChanged(bool visible)
196 Visiblity of the labels of the axis has changed to \a visible.
196 Visiblity of the labels of the axis has changed to \a visible.
197 */
197 */
198 /*!
198 /*!
199 \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible)
199 \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible)
200 Visiblity of the labels of the axis has changed to \a visible.
200 Visiblity of the labels of the axis has changed to \a visible.
201 */
201 */
202
202
203 /*!
203 /*!
204 \fn void QAbstractAxis::gridVisibleChanged(bool visible)
204 \fn void QAbstractAxis::gridVisibleChanged(bool visible)
205 Visiblity of the grid lines of the axis has changed to \a visible.
205 Visiblity of the grid lines of the axis has changed to \a visible.
206 */
206 */
207 /*!
207 /*!
208 \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible)
208 \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible)
209 Visiblity of the grid lines of the axis has changed to \a visible.
209 Visiblity of the grid lines of the axis has changed to \a visible.
210 */
210 */
211
211
212 /*!
212 /*!
213 \fn void QAbstractAxis::colorChanged(QColor color)
213 \fn void QAbstractAxis::colorChanged(QColor color)
214 Emitted if the \a color of the axis is changed.
214 Emitted if the \a color of the axis is changed.
215 */
215 */
216 /*!
216 /*!
217 \qmlsignal AbstractAxis::onColorChanged(QColor color)
217 \qmlsignal AbstractAxis::onColorChanged(QColor color)
218 Emitted if the \a color of the axis is changed.
218 Emitted if the \a color of the axis is changed.
219 */
219 */
220
220
221 /*!
221 /*!
222 \fn void QAbstractAxis::labelsColorChanged(QColor color)
222 \fn void QAbstractAxis::labelsColorChanged(QColor color)
223 Emitted if the \a color of the axis labels is changed.
223 Emitted if the \a color of the axis labels is changed.
224 */
224 */
225 /*!
225 /*!
226 \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color)
226 \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color)
227 Emitted if the \a color of the axis labels is changed.
227 Emitted if the \a color of the axis labels is changed.
228 */
228 */
229
229
230 /*!
230 /*!
231 \fn void QAbstractAxis::shadesVisibleChanged(bool)
231 \fn void QAbstractAxis::shadesVisibleChanged(bool)
232 Emitted if the visibility of the axis shades is changed to \a visible.
232 Emitted if the visibility of the axis shades is changed to \a visible.
233 */
233 */
234 /*!
234 /*!
235 \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible)
235 \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible)
236 Emitted if the visibility of the axis shades is changed to \a visible.
236 Emitted if the visibility of the axis shades is changed to \a visible.
237 */
237 */
238
238
239 /*!
239 /*!
240 \fn void QAbstractAxis::shadesColorChanged(QColor color)
240 \fn void QAbstractAxis::shadesColorChanged(QColor color)
241 Emitted if the \a color of the axis shades is changed.
241 Emitted if the \a color of the axis shades is changed.
242 */
242 */
243 /*!
243 /*!
244 \qmlsignal AbstractAxis::onShadesColorChanged(QColor color)
244 \qmlsignal AbstractAxis::onShadesColorChanged(QColor color)
245 Emitted if the \a color of the axis shades is changed.
245 Emitted if the \a color of the axis shades is changed.
246 */
246 */
247
247
248 /*!
248 /*!
249 \fn void QAbstractAxis::shadesBorderColorChanged(QColor)
249 \fn void QAbstractAxis::shadesBorderColorChanged(QColor)
250 Emitted if the border \a color of the axis shades is changed.
250 Emitted if the border \a color of the axis shades is changed.
251 */
251 */
252 /*!
252 /*!
253 \qmlsignal AbstractAxis::onBorderColorChanged(QColor color)
253 \qmlsignal AbstractAxis::onBorderColorChanged(QColor color)
254 Emitted if the border \a color of the axis shades is changed.
254 Emitted if the border \a color of the axis shades is changed.
255 */
255 */
256
256
257 /*!
257 /*!
258 \internal
258 \internal
259 Constructs new axis object which is a child of \a parent. Ownership is taken by
259 Constructs new axis object which is a child of \a parent. Ownership is taken by
260 QChart when axis added.
260 QChart when axis added.
261 */
261 */
262
262
263 QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) :
263 QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) :
264 QObject(parent),
264 QObject(parent),
265 d_ptr(&d)
265 d_ptr(&d)
266 {
266 {
267 }
267 }
268
268
269 /*!
269 /*!
270 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
270 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
271 */
271 */
272
272
273 QAbstractAxis::~QAbstractAxis()
273 QAbstractAxis::~QAbstractAxis()
274 {
274 {
275 if(d_ptr->m_dataset) qFatal("Still binded axis detected !");
275 if(d_ptr->m_dataset) qFatal("Still binded axis detected !");
276 }
276 }
277
277
278 /*!
278 /*!
279 Sets \a pen used to draw axis line and ticks.
279 Sets \a pen used to draw axis line and ticks.
280 */
280 */
281 void QAbstractAxis::setLinePen(const QPen &pen)
281 void QAbstractAxis::setLinePen(const QPen &pen)
282 {
282 {
283 if (d_ptr->m_axisPen!=pen) {
283 if (d_ptr->m_axisPen!=pen) {
284 d_ptr->m_axisPen = pen;
284 d_ptr->m_axisPen = pen;
285 d_ptr->emitUpdated();
285 d_ptr->emitUpdated();
286 }
286 }
287 }
287 }
288
288
289 /*!
289 /*!
290 Returns pen used to draw axis and ticks.
290 Returns pen used to draw axis and ticks.
291 */
291 */
292 QPen QAbstractAxis::linePen() const
292 QPen QAbstractAxis::linePen() const
293 {
293 {
294 return d_ptr->m_axisPen;
294 return d_ptr->m_axisPen;
295 }
295 }
296
296
297 void QAbstractAxis::setLinePenColor(QColor color)
297 void QAbstractAxis::setLinePenColor(QColor color)
298 {
298 {
299 QPen p = d_ptr->m_axisPen;
299 QPen p = d_ptr->m_axisPen;
300 if (p.color() != color) {
300 if (p.color() != color) {
301 p.setColor(color);
301 p.setColor(color);
302 setLinePen(p);
302 setLinePen(p);
303 emit colorChanged(color);
303 emit colorChanged(color);
304 }
304 }
305 }
305 }
306
306
307 QColor QAbstractAxis::linePenColor() const
307 QColor QAbstractAxis::linePenColor() const
308 {
308 {
309 return d_ptr->m_axisPen.color();
309 return d_ptr->m_axisPen.color();
310 }
310 }
311
311
312 /*!
312 /*!
313 Sets if axis and ticks are \a visible.
313 Sets if axis and ticks are \a visible.
314 */
314 */
315 void QAbstractAxis::setLineVisible(bool visible)
315 void QAbstractAxis::setLineVisible(bool visible)
316 {
316 {
317 if (d_ptr->m_arrowVisible != visible) {
317 if (d_ptr->m_arrowVisible != visible) {
318 d_ptr->m_arrowVisible = visible;
318 d_ptr->m_arrowVisible = visible;
319 d_ptr->emitUpdated();
319 d_ptr->emitUpdated();
320 emit lineVisibleChanged(visible);
320 emit lineVisibleChanged(visible);
321 }
321 }
322 }
322 }
323
323
324 bool QAbstractAxis::isLineVisible() const
324 bool QAbstractAxis::isLineVisible() const
325 {
325 {
326 return d_ptr->m_arrowVisible;
326 return d_ptr->m_arrowVisible;
327 }
327 }
328
328
329 void QAbstractAxis::setGridLineVisible(bool visible)
329 void QAbstractAxis::setGridLineVisible(bool visible)
330 {
330 {
331 if (d_ptr->m_gridLineVisible != visible) {
331 if (d_ptr->m_gridLineVisible != visible) {
332 d_ptr->m_gridLineVisible = visible;
332 d_ptr->m_gridLineVisible = visible;
333 d_ptr->emitUpdated();
333 d_ptr->emitUpdated();
334 emit gridVisibleChanged(visible);
334 emit gridVisibleChanged(visible);
335 }
335 }
336 }
336 }
337
337
338 bool QAbstractAxis::isGridLineVisible() const
338 bool QAbstractAxis::isGridLineVisible() const
339 {
339 {
340 return d_ptr->m_gridLineVisible;
340 return d_ptr->m_gridLineVisible;
341 }
341 }
342
342
343 /*!
343 /*!
344 Sets \a pen used to draw grid line.
344 Sets \a pen used to draw grid line.
345 */
345 */
346 void QAbstractAxis::setGridLinePen(const QPen &pen)
346 void QAbstractAxis::setGridLinePen(const QPen &pen)
347 {
347 {
348 if (d_ptr->m_gridLinePen != pen) {
348 if (d_ptr->m_gridLinePen != pen) {
349 d_ptr->m_gridLinePen = pen;
349 d_ptr->m_gridLinePen = pen;
350 d_ptr->emitUpdated();
350 d_ptr->emitUpdated();
351 }
351 }
352 }
352 }
353
353
354 /*!
354 /*!
355 Returns pen used to draw grid.
355 Returns pen used to draw grid.
356 */
356 */
357 QPen QAbstractAxis::gridLinePen() const
357 QPen QAbstractAxis::gridLinePen() const
358 {
358 {
359 return d_ptr->m_gridLinePen;
359 return d_ptr->m_gridLinePen;
360 }
360 }
361
361
362 void QAbstractAxis::setLabelsVisible(bool visible)
362 void QAbstractAxis::setLabelsVisible(bool visible)
363 {
363 {
364 if (d_ptr->m_labelsVisible != visible) {
364 if (d_ptr->m_labelsVisible != visible) {
365 d_ptr->m_labelsVisible = visible;
365 d_ptr->m_labelsVisible = visible;
366 d_ptr->emitUpdated();
366 d_ptr->emitUpdated();
367 emit labelsVisibleChanged(visible);
367 emit labelsVisibleChanged(visible);
368 }
368 }
369 }
369 }
370
370
371 bool QAbstractAxis::labelsVisible() const
371 bool QAbstractAxis::labelsVisible() const
372 {
372 {
373 return d_ptr->m_labelsVisible;
373 return d_ptr->m_labelsVisible;
374 }
374 }
375
375
376 /*!
376 /*!
377 Sets \a pen used to draw labels.
377 Sets \a pen used to draw labels.
378 */
378 */
379 void QAbstractAxis::setLabelsPen(const QPen &pen)
379 void QAbstractAxis::setLabelsPen(const QPen &pen)
380 {
380 {
381 if (d_ptr->m_labelsPen != pen) {
381 if (d_ptr->m_labelsPen != pen) {
382 d_ptr->m_labelsPen = pen;
382 d_ptr->m_labelsPen = pen;
383 d_ptr->emitUpdated();
383 d_ptr->emitUpdated();
384 }
384 }
385 }
385 }
386
386
387 /*!
387 /*!
388 Returns the pen used to labels.
388 Returns the pen used to labels.
389 */
389 */
390 QPen QAbstractAxis::labelsPen() const
390 QPen QAbstractAxis::labelsPen() const
391 {
391 {
392 return d_ptr->m_labelsPen;
392 return d_ptr->m_labelsPen;
393 }
393 }
394
394
395 /*!
395 /*!
396 Sets \a brush used to draw labels.
396 Sets \a brush used to draw labels.
397 */
397 */
398 void QAbstractAxis::setLabelsBrush(const QBrush &brush)
398 void QAbstractAxis::setLabelsBrush(const QBrush &brush)
399 {
399 {
400 if (d_ptr->m_labelsBrush != brush) {
400 if (d_ptr->m_labelsBrush != brush) {
401 d_ptr->m_labelsBrush = brush;
401 d_ptr->m_labelsBrush = brush;
402 d_ptr->emitUpdated();
402 d_ptr->emitUpdated();
403 }
403 }
404 }
404 }
405
405
406 /*!
406 /*!
407 Returns brush used to draw labels.
407 Returns brush used to draw labels.
408 */
408 */
409 QBrush QAbstractAxis::labelsBrush() const
409 QBrush QAbstractAxis::labelsBrush() const
410 {
410 {
411 return d_ptr->m_labelsBrush;
411 return d_ptr->m_labelsBrush;
412 }
412 }
413
413
414 /*!
414 /*!
415 Sets \a font used to draw labels.
415 Sets \a font used to draw labels.
416 */
416 */
417 void QAbstractAxis::setLabelsFont(const QFont &font)
417 void QAbstractAxis::setLabelsFont(const QFont &font)
418 {
418 {
419 if (d_ptr->m_labelsFont != font) {
419 if (d_ptr->m_labelsFont != font) {
420 d_ptr->m_labelsFont = font;
420 d_ptr->m_labelsFont = font;
421 d_ptr->emitUpdated();
421 d_ptr->emitUpdated();
422 }
422 }
423 }
423 }
424
424
425 /*!
425 /*!
426 Returns font used to draw labels.
426 Returns font used to draw labels.
427 */
427 */
428 QFont QAbstractAxis::labelsFont() const
428 QFont QAbstractAxis::labelsFont() const
429 {
429 {
430 return d_ptr->m_labelsFont;
430 return d_ptr->m_labelsFont;
431 }
431 }
432
432
433 void QAbstractAxis::setLabelsAngle(int angle)
433 void QAbstractAxis::setLabelsAngle(int angle)
434 {
434 {
435 if (d_ptr->m_labelsAngle != angle) {
435 if (d_ptr->m_labelsAngle != angle) {
436 d_ptr->m_labelsAngle = angle;
436 d_ptr->m_labelsAngle = angle;
437 d_ptr->emitUpdated();
437 d_ptr->emitUpdated();
438 }
438 }
439 }
439 }
440
440
441 int QAbstractAxis::labelsAngle() const
441 int QAbstractAxis::labelsAngle() const
442 {
442 {
443 return d_ptr->m_labelsAngle;
443 return d_ptr->m_labelsAngle;
444 }
444 }
445
445
446 void QAbstractAxis::setLabelsColor(QColor color)
446 void QAbstractAxis::setLabelsColor(QColor color)
447 {
447 {
448 QBrush b = d_ptr->m_labelsBrush;
448 QBrush b = d_ptr->m_labelsBrush;
449 if (b.color() != color) {
449 if (b.color() != color) {
450 b.setColor(color);
450 b.setColor(color);
451 setLabelsBrush(b);
451 setLabelsBrush(b);
452 emit labelsColorChanged(color);
452 emit labelsColorChanged(color);
453 }
453 }
454 }
454 }
455
455
456 QColor QAbstractAxis::labelsColor() const
456 QColor QAbstractAxis::labelsColor() const
457 {
457 {
458 return d_ptr->m_labelsBrush.color();
458 return d_ptr->m_labelsBrush.color();
459 }
459 }
460
460
461 void QAbstractAxis::setShadesVisible(bool visible)
461 void QAbstractAxis::setShadesVisible(bool visible)
462 {
462 {
463 if (d_ptr->m_shadesVisible != visible) {
463 if (d_ptr->m_shadesVisible != visible) {
464 d_ptr->m_shadesVisible = visible;
464 d_ptr->m_shadesVisible = visible;
465 d_ptr->emitUpdated();
465 d_ptr->emitUpdated();
466 emit shadesVisibleChanged(visible);
466 emit shadesVisibleChanged(visible);
467 }
467 }
468 }
468 }
469
469
470 bool QAbstractAxis::shadesVisible() const
470 bool QAbstractAxis::shadesVisible() const
471 {
471 {
472 return d_ptr->m_shadesVisible;
472 return d_ptr->m_shadesVisible;
473 }
473 }
474
474
475 /*!
475 /*!
476 Sets \a pen used to draw shades.
476 Sets \a pen used to draw shades.
477 */
477 */
478 void QAbstractAxis::setShadesPen(const QPen &pen)
478 void QAbstractAxis::setShadesPen(const QPen &pen)
479 {
479 {
480 if (d_ptr->m_shadesPen != pen) {
480 if (d_ptr->m_shadesPen != pen) {
481 d_ptr->m_shadesPen = pen;
481 d_ptr->m_shadesPen = pen;
482 d_ptr->emitUpdated();
482 d_ptr->emitUpdated();
483 }
483 }
484 }
484 }
485
485
486 /*!
486 /*!
487 Returns pen used to draw shades.
487 Returns pen used to draw shades.
488 */
488 */
489 QPen QAbstractAxis::shadesPen() const
489 QPen QAbstractAxis::shadesPen() const
490 {
490 {
491 return d_ptr->m_shadesPen;
491 return d_ptr->m_shadesPen;
492 }
492 }
493
493
494 /*!
494 /*!
495 Sets \a brush used to draw shades.
495 Sets \a brush used to draw shades.
496 */
496 */
497 void QAbstractAxis::setShadesBrush(const QBrush &brush)
497 void QAbstractAxis::setShadesBrush(const QBrush &brush)
498 {
498 {
499 if (d_ptr->m_shadesBrush != brush) {
499 if (d_ptr->m_shadesBrush != brush) {
500 d_ptr->m_shadesBrush = brush;
500 d_ptr->m_shadesBrush = brush;
501 d_ptr->emitUpdated();
501 d_ptr->emitUpdated();
502 emit shadesColorChanged(brush.color());
502 emit shadesColorChanged(brush.color());
503 }
503 }
504 }
504 }
505
505
506 /*!
506 /*!
507 Returns brush used to draw shades.
507 Returns brush used to draw shades.
508 */
508 */
509 QBrush QAbstractAxis::shadesBrush() const
509 QBrush QAbstractAxis::shadesBrush() const
510 {
510 {
511 return d_ptr->m_shadesBrush;
511 return d_ptr->m_shadesBrush;
512 }
512 }
513
513
514 void QAbstractAxis::setShadesColor(QColor color)
514 void QAbstractAxis::setShadesColor(QColor color)
515 {
515 {
516 QBrush b = d_ptr->m_shadesBrush;
516 QBrush b = d_ptr->m_shadesBrush;
517 b.setColor(color);
517 b.setColor(color);
518 setShadesBrush(b);
518 setShadesBrush(b);
519 }
519 }
520
520
521 QColor QAbstractAxis::shadesColor() const
521 QColor QAbstractAxis::shadesColor() const
522 {
522 {
523 return d_ptr->m_shadesBrush.color();
523 return d_ptr->m_shadesBrush.color();
524 }
524 }
525
525
526 void QAbstractAxis::setShadesBorderColor(QColor color)
526 void QAbstractAxis::setShadesBorderColor(QColor color)
527 {
527 {
528 QPen p = d_ptr->m_shadesPen;
528 QPen p = d_ptr->m_shadesPen;
529 p.setColor(color);
529 p.setColor(color);
530 setShadesPen(p);
530 setShadesPen(p);
531 }
531 }
532
532
533 QColor QAbstractAxis::shadesBorderColor() const
533 QColor QAbstractAxis::shadesBorderColor() const
534 {
534 {
535 return d_ptr->m_shadesPen.color();
535 return d_ptr->m_shadesPen.color();
536 }
536 }
537
537
538
538
539 bool QAbstractAxis::isVisible() const
539 bool QAbstractAxis::isVisible() const
540 {
540 {
541 return d_ptr->m_visible;
541 return d_ptr->m_visible;
542 }
542 }
543
543
544 /*!
544 /*!
545 Sets axis, shades, labels and grid lines to be visible.
545 Sets axis, shades, labels and grid lines to be visible.
546 */
546 */
547 void QAbstractAxis::setVisible(bool visible)
547 void QAbstractAxis::setVisible(bool visible)
548 {
548 {
549 if(d_ptr->m_visible!=visible){
549 if(d_ptr->m_visible!=visible){
550 d_ptr->m_visible=visible;
550 d_ptr->m_visible=visible;
551 d_ptr->emitUpdated();
551 d_ptr->emitUpdated();
552 emit visibleChanged(visible);
552 emit visibleChanged(visible);
553 }
553 }
554 }
554 }
555
555
556
556
557 /*!
557 /*!
558 Sets axis, shades, labels and grid lines to be visible.
558 Sets axis, shades, labels and grid lines to be visible.
559 */
559 */
560 void QAbstractAxis::show()
560 void QAbstractAxis::show()
561 {
561 {
562 setVisible(true);
562 setVisible(true);
563 }
563 }
564
564
565 /*!
565 /*!
566 Sets axis, shades, labels and grid lines to not be visible.
566 Sets axis, shades, labels and grid lines to not be visible.
567 */
567 */
568 void QAbstractAxis::hide()
568 void QAbstractAxis::hide()
569 {
569 {
570 setVisible(false);
570 setVisible(false);
571 }
571 }
572
572
573 /*!
573 /*!
574 Sets the minimum value shown on the axis.
574 Sets the minimum value shown on the axis.
575 Depending on the actual axis type the \a min paramter is converted to appropriate type.
575 Depending on the actual axis type the \a min paramter is converted to appropriate type.
576 If the conversion is impossible then the function call does nothing
576 If the conversion is impossible then the function call does nothing
577 */
577 */
578 void QAbstractAxis::setMin(const QVariant &min)
578 void QAbstractAxis::setMin(const QVariant &min)
579 {
579 {
580 d_ptr->setMin(min);
580 d_ptr->setMin(min);
581 }
581 }
582
582
583 /*!
583 /*!
584 Sets the maximum value shown on the axis.
584 Sets the maximum value shown on the axis.
585 Depending on the actual axis type the \a max paramter is converted to appropriate type.
585 Depending on the actual axis type the \a max paramter is converted to appropriate type.
586 If the conversion is impossible then the function call does nothing
586 If the conversion is impossible then the function call does nothing
587 */
587 */
588 void QAbstractAxis::setMax(const QVariant &max)
588 void QAbstractAxis::setMax(const QVariant &max)
589 {
589 {
590 d_ptr->setMax(max);
590 d_ptr->setMax(max);
591 }
591 }
592
592
593 /*!
593 /*!
594 Sets the range shown on the axis.
594 Sets the range shown on the axis.
595 Depending on the actual axis type the \a min and \a max paramters are converted to appropriate types.
595 Depending on the actual axis type the \a min and \a max paramters are converted to appropriate types.
596 If the conversion is impossible then the function call does nothing.
596 If the conversion is impossible then the function call does nothing.
597 */
597 */
598 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
598 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
599 {
599 {
600 d_ptr->setRange(min,max);
600 d_ptr->setRange(min,max);
601 }
601 }
602
602
603
603
604 /*!
604 /*!
605 Returns the orientation in which the axis is being used (Vertical or Horizontal)
605 Returns the orientation in which the axis is being used (Vertical or Horizontal)
606 */
606 */
607 Qt::Orientation QAbstractAxis::orientation()
607 Qt::Orientation QAbstractAxis::orientation()
608 {
608 {
609 return d_ptr->m_orientation;
609 return d_ptr->m_orientation;
610 }
610 }
611
611
612 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
612 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
613
613
614 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* q):
614 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* q):
615 q_ptr(q),
615 q_ptr(q),
616 m_orientation(Qt::Orientation(0)),
616 m_orientation(Qt::Orientation(0)),
617 m_dataset(0),
617 m_dataset(0),
618 m_visible(false),
618 m_visible(false),
619 m_arrowVisible(true),
619 m_arrowVisible(true),
620 m_gridLineVisible(true),
620 m_gridLineVisible(true),
621 m_labelsVisible(true),
621 m_labelsVisible(true),
622 m_labelsAngle(0),
622 m_labelsAngle(0),
623 m_shadesVisible(false),
623 m_shadesVisible(false),
624 m_shadesBrush(Qt::SolidPattern),
624 m_shadesBrush(Qt::SolidPattern),
625 m_shadesOpacity(1.0),
625 m_shadesOpacity(1.0),
626 m_dirty(false)
626 m_dirty(false)
627 {
627 {
628
628
629 }
629 }
630
630
631 QAbstractAxisPrivate::~QAbstractAxisPrivate()
631 QAbstractAxisPrivate::~QAbstractAxisPrivate()
632 {
632 {
633
633
634 }
634 }
635
635
636 void QAbstractAxisPrivate::emitUpdated()
636 void QAbstractAxisPrivate::emitUpdated()
637 {
637 {
638 if(!m_dirty){
638 if(!m_dirty){
639 m_dirty=true;
639 m_dirty=true;
640 emit updated();
640 emit updated();
641 }
641 }
642 }
642 }
643
643
644 void QAbstractAxisPrivate::setDirty(bool dirty)
644 void QAbstractAxisPrivate::setDirty(bool dirty)
645 {
645 {
646 m_dirty=dirty;
646 m_dirty=dirty;
647 }
647 }
648
648
649 void QAbstractAxisPrivate::setOrientation(Qt::Orientation orientation)
649 void QAbstractAxisPrivate::setOrientation(Qt::Orientation orientation)
650 {
650 {
651 m_orientation=orientation;
651 m_orientation=orientation;
652 }
652 }
653
653
654
654
655 #include "moc_qabstractaxis.cpp"
655 #include "moc_qabstractaxis.cpp"
656 #include "moc_qabstractaxis_p.cpp"
656 #include "moc_qabstractaxis_p.cpp"
657
657
658 QTCOMMERCIALCHART_END_NAMESPACE
658 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now