@@ -1,585 +1,601 | |||||
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, however there can be multiple y axes. |
|
31 | There is only one x Axis, 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 Axis QAbstractAxis |
|
37 | \qmlclass Axis 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, however there can be multiple y axes on a ChartView. |
|
40 | There is only one x Axis, 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 AxisTypeValues |
|
63 | \value AxisTypeValues | |
64 | \value AxisTypeCategories |
|
64 | \value AxisTypeCategories | |
65 | */ |
|
65 | */ | |
66 |
|
66 | |||
67 | /*! |
|
67 | /*! | |
68 | \property QAbstractAxis::arrowVisible |
|
68 | \property QAbstractAxis::arrowVisible | |
69 | The visibility of the axis arrow |
|
69 | The visibility of the axis arrow | |
70 | */ |
|
70 | */ | |
71 | /*! |
|
71 | /*! | |
72 | \qmlproperty bool Axis::arrrowVisible |
|
72 | \qmlproperty bool Axis::arrrowVisible | |
73 | The visibility of the axis arrow |
|
73 | The visibility of the axis arrow | |
74 | */ |
|
74 | */ | |
75 |
|
75 | |||
76 | /*! |
|
76 | /*! | |
77 | \property QAbstractAxis::labelsVisible |
|
77 | \property QAbstractAxis::labelsVisible | |
78 | Defines if axis labels are visible. |
|
78 | Defines if axis labels are visible. | |
79 | */ |
|
79 | */ | |
80 | /*! |
|
80 | /*! | |
81 | \qmlproperty bool Axis::labelsVisible |
|
81 | \qmlproperty bool Axis::labelsVisible | |
82 | Defines if axis labels are visible. |
|
82 | Defines if axis labels are visible. | |
83 | */ |
|
83 | */ | |
84 |
|
84 | |||
85 | /*! |
|
85 | /*! | |
86 | \property QAbstractAxis::visible |
|
86 | \property QAbstractAxis::visible | |
87 | The visibility of the axis. |
|
87 | The visibility of the axis. | |
88 | */ |
|
88 | */ | |
89 | /*! |
|
89 | /*! | |
90 | \qmlproperty bool Axis::visible |
|
90 | \qmlproperty bool Axis::visible | |
91 | The visibility of the axis. |
|
91 | The visibility of the axis. | |
92 | */ |
|
92 | */ | |
93 |
|
93 | |||
94 | /*! |
|
94 | /*! | |
95 | \property QAbstractAxis::gridVisible |
|
95 | \property QAbstractAxis::gridVisible | |
96 | The visibility of the grid lines. |
|
96 | The visibility of the grid lines. | |
97 | */ |
|
97 | */ | |
98 | /*! |
|
98 | /*! | |
99 | \qmlproperty bool Axis::gridVisible |
|
99 | \qmlproperty bool Axis::gridVisible | |
100 | The visibility of the grid lines. |
|
100 | The visibility of the grid lines. | |
101 | */ |
|
101 | */ | |
102 |
|
102 | |||
103 | /*! |
|
103 | /*! | |
104 | \property QAbstractAxis::color |
|
104 | \property QAbstractAxis::color | |
105 | The color of the axis and ticks. |
|
105 | The color of the axis and ticks. | |
106 | */ |
|
106 | */ | |
107 | /*! |
|
107 | /*! | |
108 | \qmlproperty color Axis::color |
|
108 | \qmlproperty color Axis::color | |
109 | The color of the axis and ticks. |
|
109 | The color of the axis and ticks. | |
110 | */ |
|
110 | */ | |
111 |
|
111 | |||
112 | /*! |
|
112 | /*! | |
113 | \property QAbstractAxis::labelsFont |
|
113 | \property QAbstractAxis::labelsFont | |
114 | The font of the axis labels. |
|
114 | The font of the axis labels. | |
115 | */ |
|
115 | */ | |
116 |
|
116 | |||
117 | /*! |
|
117 | /*! | |
118 | \qmlproperty Font Axis::labelsFont |
|
118 | \qmlproperty Font Axis::labelsFont | |
119 | The font of the axis labels. |
|
119 | The font of the axis labels. | |
120 |
|
120 | |||
121 | See the \l {Font} {QML Font Element} for detailed documentation. |
|
121 | See the \l {Font} {QML Font Element} for detailed documentation. | |
122 | */ |
|
122 | */ | |
123 |
|
123 | |||
124 | /*! |
|
124 | /*! | |
125 | \property QAbstractAxis::labelsColor |
|
125 | \property QAbstractAxis::labelsColor | |
126 | The color of the axis labels. |
|
126 | The color of the axis labels. | |
127 | */ |
|
127 | */ | |
128 | /*! |
|
128 | /*! | |
129 | \qmlproperty color Axis::labelsColor |
|
129 | \qmlproperty color Axis::labelsColor | |
130 | The color of the axis labels. |
|
130 | The color of the axis labels. | |
131 | */ |
|
131 | */ | |
132 |
|
132 | |||
133 | /*! |
|
133 | /*! | |
134 | \property QAbstractAxis::labelsAngle |
|
134 | \property QAbstractAxis::labelsAngle | |
135 | The angle of the axis labels in degrees. |
|
135 | The angle of the axis labels in degrees. | |
136 | */ |
|
136 | */ | |
137 | /*! |
|
137 | /*! | |
138 | \qmlproperty int Axis::labelsAngle |
|
138 | \qmlproperty int Axis::labelsAngle | |
139 | The angle of the axis labels in degrees. |
|
139 | The angle of the axis labels in degrees. | |
140 | */ |
|
140 | */ | |
141 |
|
141 | |||
142 | /*! |
|
142 | /*! | |
143 | \property QAbstractAxis::shadesVisible |
|
143 | \property QAbstractAxis::shadesVisible | |
144 | The visibility of the axis shades. |
|
144 | The visibility of the axis shades. | |
145 | */ |
|
145 | */ | |
146 | /*! |
|
146 | /*! | |
147 | \qmlproperty bool Axis::shadesVisible |
|
147 | \qmlproperty bool Axis::shadesVisible | |
148 | The visibility of the axis shades. |
|
148 | The visibility of the axis shades. | |
149 | */ |
|
149 | */ | |
150 |
|
150 | |||
151 | /*! |
|
151 | /*! | |
152 | \property QAbstractAxis::shadesColor |
|
152 | \property QAbstractAxis::shadesColor | |
153 | The fill (brush) color of the axis shades. |
|
153 | The fill (brush) color of the axis shades. | |
154 | */ |
|
154 | */ | |
155 | /*! |
|
155 | /*! | |
156 | \qmlproperty color Axis::shadesColor |
|
156 | \qmlproperty color Axis::shadesColor | |
157 | The fill (brush) color of the axis shades. |
|
157 | The fill (brush) color of the axis shades. | |
158 | */ |
|
158 | */ | |
159 |
|
159 | |||
160 | /*! |
|
160 | /*! | |
161 | \property QAbstractAxis::shadesBorderColor |
|
161 | \property QAbstractAxis::shadesBorderColor | |
162 | The border (pen) color of the axis shades. |
|
162 | The border (pen) color of the axis shades. | |
163 | */ |
|
163 | */ | |
164 | /*! |
|
164 | /*! | |
165 | \qmlproperty color Axis::shadesBorderColor |
|
165 | \qmlproperty color Axis::shadesBorderColor | |
166 | The border (pen) color of the axis shades. |
|
166 | The border (pen) color of the axis shades. | |
167 | */ |
|
167 | */ | |
168 |
|
168 | |||
169 | /*! |
|
169 | /*! | |
170 | \fn void QAbstractAxis::visibleChanged(bool) |
|
170 | \fn void QAbstractAxis::visibleChanged(bool) | |
171 | Visiblity of the axis has changed to \a visible. |
|
171 | Visiblity of the axis has changed to \a visible. | |
172 | */ |
|
172 | */ | |
173 |
|
173 | |||
174 | /*! |
|
174 | /*! | |
175 | \fn void QAbstractAxis::labelsVisibleChanged(bool) |
|
175 | \fn void QAbstractAxis::labelsVisibleChanged(bool) | |
176 | Visiblity of the labels of the axis has changed to \a visible. |
|
176 | Visiblity of the labels of the axis has changed to \a visible. | |
177 | */ |
|
177 | */ | |
178 |
|
178 | |||
179 | /*! |
|
179 | /*! | |
180 | \fn void QAbstractAxis::gridVisibleChanged(bool) |
|
180 | \fn void QAbstractAxis::gridVisibleChanged(bool) | |
181 | Visiblity of the grid lines of the axis has changed to \a visible. |
|
181 | Visiblity of the grid lines of the axis has changed to \a visible. | |
182 | */ |
|
182 | */ | |
183 |
|
183 | |||
184 | /* |
|
184 | /* | |
185 | \fn void QAbstractAxis::minChanged(qreal min) |
|
185 | \fn void QAbstractAxis::minChanged(qreal min) | |
186 | Axis emits signal when \a min of axis has changed. |
|
186 | Axis emits signal when \a min of axis has changed. | |
187 | */ |
|
187 | */ | |
188 |
|
188 | |||
189 | /* |
|
189 | /* | |
190 | \fn void QAbstractAxis::maxChanged(qreal max) |
|
190 | \fn void QAbstractAxis::maxChanged(qreal max) | |
191 | Axis emits signal when \a max of axis has changed. |
|
191 | Axis emits signal when \a max of axis has changed. | |
192 | */ |
|
192 | */ | |
193 |
|
193 | |||
194 | /* |
|
194 | /* | |
195 | \fn void QAbstractAxis::rangeChanged(qreal min, qreal max) |
|
195 | \fn void QAbstractAxis::rangeChanged(qreal min, qreal max) | |
196 | Axis emits signal when \a min or \a max of axis has changed. |
|
196 | Axis emits signal when \a min or \a max of axis has changed. | |
197 | */ |
|
197 | */ | |
198 |
|
198 | |||
199 | /* |
|
199 | /* | |
200 | \fn QChartAxisCategories* QAbstractAxis::categories() |
|
200 | \fn QChartAxisCategories* QAbstractAxis::categories() | |
201 | Returns pointer to the list of categories which correspond to the values on the axis. |
|
201 | Returns pointer to the list of categories which correspond to the values on the axis. | |
202 | */ |
|
202 | */ | |
203 |
|
203 | |||
204 | /*! |
|
204 | /*! | |
205 | \fn void QAbstractAxis::colorChanged(QColor) |
|
205 | \fn void QAbstractAxis::colorChanged(QColor) | |
206 | Emitted if the \a color of the axis is changed. |
|
206 | Emitted if the \a color of the axis is changed. | |
207 | */ |
|
207 | */ | |
208 |
|
208 | |||
209 | /*! |
|
209 | /*! | |
210 | \fn void QAbstractAxis::labelsColorChanged(QColor) |
|
210 | \fn void QAbstractAxis::labelsColorChanged(QColor) | |
211 | Emitted if the \a color of the axis labels is changed. |
|
211 | Emitted if the \a color of the axis labels is changed. | |
212 | */ |
|
212 | */ | |
213 |
|
213 | |||
214 | /*! |
|
214 | /*! | |
215 | \fn void QAbstractAxis::shadesVisibleChanged(bool) |
|
215 | \fn void QAbstractAxis::shadesVisibleChanged(bool) | |
216 | Emitted if the visibility of the axis shades is changed to \a visible. |
|
216 | Emitted if the visibility of the axis shades is changed to \a visible. | |
217 | */ |
|
217 | */ | |
218 |
|
218 | |||
219 | /*! |
|
219 | /*! | |
220 | \fn void QAbstractAxis::shadesColorChanged(QColor) |
|
220 | \fn void QAbstractAxis::shadesColorChanged(QColor) | |
221 | Emitted if the \a color of the axis shades is changed. |
|
221 | Emitted if the \a color of the axis shades is changed. | |
222 | */ |
|
222 | */ | |
223 |
|
223 | |||
224 | /*! |
|
224 | /*! | |
225 | \fn void QAbstractAxis::shadesBorderColorChanged(QColor) |
|
225 | \fn void QAbstractAxis::shadesBorderColorChanged(QColor) | |
226 | Emitted if the border \a color of the axis shades is changed. |
|
226 | Emitted if the border \a color of the axis shades is changed. | |
227 | */ |
|
227 | */ | |
228 |
|
228 | |||
229 | /*! |
|
229 | /*! | |
230 | Constructs new axis object which is a child of \a parent. Ownership is taken by |
|
230 | Constructs new axis object which is a child of \a parent. Ownership is taken by | |
231 | QChart when axis added. |
|
231 | QChart when axis added. | |
232 | */ |
|
232 | */ | |
233 |
|
233 | |||
234 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) : |
|
234 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) : | |
235 | QObject(parent), |
|
235 | QObject(parent), | |
236 | d_ptr(&d) |
|
236 | d_ptr(&d) | |
237 | { |
|
237 | { | |
238 | } |
|
238 | } | |
239 |
|
239 | |||
240 | /*! |
|
240 | /*! | |
241 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. |
|
241 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. | |
242 | */ |
|
242 | */ | |
243 |
|
243 | |||
244 | QAbstractAxis::~QAbstractAxis() |
|
244 | QAbstractAxis::~QAbstractAxis() | |
245 | { |
|
245 | { | |
246 | } |
|
246 | } | |
247 |
|
247 | |||
248 | /*! |
|
248 | /*! | |
249 | Sets \a pen used to draw axis line and ticks. |
|
249 | Sets \a pen used to draw axis line and ticks. | |
250 | */ |
|
250 | */ | |
251 | void QAbstractAxis::setAxisPen(const QPen &pen) |
|
251 | void QAbstractAxis::setAxisPen(const QPen &pen) | |
252 | { |
|
252 | { | |
253 | if (d_ptr->m_axisPen!=pen) { |
|
253 | if (d_ptr->m_axisPen!=pen) { | |
254 | d_ptr->m_axisPen = pen; |
|
254 | d_ptr->m_axisPen = pen; | |
255 | emit d_ptr->updated(); |
|
255 | emit d_ptr->updated(); | |
256 | } |
|
256 | } | |
257 | } |
|
257 | } | |
258 |
|
258 | |||
259 | /*! |
|
259 | /*! | |
260 | Returns pen used to draw axis and ticks. |
|
260 | Returns pen used to draw axis and ticks. | |
261 | */ |
|
261 | */ | |
262 | QPen QAbstractAxis::axisPen() const |
|
262 | QPen QAbstractAxis::axisPen() const | |
263 | { |
|
263 | { | |
264 | return d_ptr->m_axisPen; |
|
264 | return d_ptr->m_axisPen; | |
265 | } |
|
265 | } | |
266 |
|
266 | |||
267 | void QAbstractAxis::setAxisPenColor(QColor color) |
|
267 | void QAbstractAxis::setAxisPenColor(QColor color) | |
268 | { |
|
268 | { | |
269 | QPen p = d_ptr->m_axisPen; |
|
269 | QPen p = d_ptr->m_axisPen; | |
270 | if (p.color() != color) { |
|
270 | if (p.color() != color) { | |
271 | p.setColor(color); |
|
271 | p.setColor(color); | |
272 | setAxisPen(p); |
|
272 | setAxisPen(p); | |
273 | emit colorChanged(color); |
|
273 | emit colorChanged(color); | |
274 | } |
|
274 | } | |
275 | } |
|
275 | } | |
276 |
|
276 | |||
277 | QColor QAbstractAxis::axisPenColor() const |
|
277 | QColor QAbstractAxis::axisPenColor() const | |
278 | { |
|
278 | { | |
279 | return d_ptr->m_axisPen.color(); |
|
279 | return d_ptr->m_axisPen.color(); | |
280 | } |
|
280 | } | |
281 |
|
281 | |||
282 | /*! |
|
282 | /*! | |
283 | Sets if axis and ticks are \a visible. |
|
283 | Sets if axis and ticks are \a visible. | |
284 | */ |
|
284 | */ | |
285 | void QAbstractAxis::setAxisVisible(bool visible) |
|
285 | void QAbstractAxis::setAxisVisible(bool visible) | |
286 | { |
|
286 | { | |
287 | if (d_ptr->m_axisVisible != visible) { |
|
287 | if (d_ptr->m_axisVisible != visible) { | |
288 | d_ptr->m_axisVisible = visible; |
|
288 | d_ptr->m_axisVisible = visible; | |
289 | emit d_ptr->updated(); |
|
289 | emit d_ptr->updated(); | |
290 | emit visibleChanged(visible); |
|
290 | emit visibleChanged(visible); | |
291 | } |
|
291 | } | |
292 | } |
|
292 | } | |
293 |
|
293 | |||
294 | bool QAbstractAxis::isAxisVisible() const |
|
294 | bool QAbstractAxis::isAxisVisible() const | |
295 | { |
|
295 | { | |
296 | return d_ptr->m_axisVisible; |
|
296 | return d_ptr->m_axisVisible; | |
297 | } |
|
297 | } | |
298 |
|
298 | |||
299 | void QAbstractAxis::setGridLineVisible(bool visible) |
|
299 | void QAbstractAxis::setGridLineVisible(bool visible) | |
300 | { |
|
300 | { | |
301 | if (d_ptr->m_gridLineVisible != visible) { |
|
301 | if (d_ptr->m_gridLineVisible != visible) { | |
302 | d_ptr->m_gridLineVisible = visible; |
|
302 | d_ptr->m_gridLineVisible = visible; | |
303 | emit d_ptr->updated(); |
|
303 | emit d_ptr->updated(); | |
304 | emit gridVisibleChanged(visible); |
|
304 | emit gridVisibleChanged(visible); | |
305 | } |
|
305 | } | |
306 | } |
|
306 | } | |
307 |
|
307 | |||
308 | bool QAbstractAxis::isGridLineVisible() const |
|
308 | bool QAbstractAxis::isGridLineVisible() const | |
309 | { |
|
309 | { | |
310 | return d_ptr->m_gridLineVisible; |
|
310 | return d_ptr->m_gridLineVisible; | |
311 | } |
|
311 | } | |
312 |
|
312 | |||
313 | /*! |
|
313 | /*! | |
314 | Sets \a pen used to draw grid line. |
|
314 | Sets \a pen used to draw grid line. | |
315 | */ |
|
315 | */ | |
316 | void QAbstractAxis::setGridLinePen(const QPen &pen) |
|
316 | void QAbstractAxis::setGridLinePen(const QPen &pen) | |
317 | { |
|
317 | { | |
318 | if (d_ptr->m_gridLinePen != pen) { |
|
318 | if (d_ptr->m_gridLinePen != pen) { | |
319 | d_ptr->m_gridLinePen = pen; |
|
319 | d_ptr->m_gridLinePen = pen; | |
320 | emit d_ptr->updated(); |
|
320 | emit d_ptr->updated(); | |
321 | } |
|
321 | } | |
322 | } |
|
322 | } | |
323 |
|
323 | |||
324 | /*! |
|
324 | /*! | |
325 | Returns pen used to draw grid. |
|
325 | Returns pen used to draw grid. | |
326 | */ |
|
326 | */ | |
327 | QPen QAbstractAxis::gridLinePen() const |
|
327 | QPen QAbstractAxis::gridLinePen() const | |
328 | { |
|
328 | { | |
329 | return d_ptr->m_gridLinePen; |
|
329 | return d_ptr->m_gridLinePen; | |
330 | } |
|
330 | } | |
331 |
|
331 | |||
332 | void QAbstractAxis::setLabelsVisible(bool visible) |
|
332 | void QAbstractAxis::setLabelsVisible(bool visible) | |
333 | { |
|
333 | { | |
334 | if (d_ptr->m_labelsVisible != visible) { |
|
334 | if (d_ptr->m_labelsVisible != visible) { | |
335 | d_ptr->m_labelsVisible = visible; |
|
335 | d_ptr->m_labelsVisible = visible; | |
336 | emit d_ptr->updated(); |
|
336 | emit d_ptr->updated(); | |
337 | emit labelsVisibleChanged(visible); |
|
337 | emit labelsVisibleChanged(visible); | |
338 | } |
|
338 | } | |
339 | } |
|
339 | } | |
340 |
|
340 | |||
341 | bool QAbstractAxis::labelsVisible() const |
|
341 | bool QAbstractAxis::labelsVisible() const | |
342 | { |
|
342 | { | |
343 | return d_ptr->m_labelsVisible; |
|
343 | return d_ptr->m_labelsVisible; | |
344 | } |
|
344 | } | |
345 |
|
345 | |||
346 | /*! |
|
346 | /*! | |
347 | Sets \a pen used to draw labels. |
|
347 | Sets \a pen used to draw labels. | |
348 | */ |
|
348 | */ | |
349 | void QAbstractAxis::setLabelsPen(const QPen &pen) |
|
349 | void QAbstractAxis::setLabelsPen(const QPen &pen) | |
350 | { |
|
350 | { | |
351 | if (d_ptr->m_labelsPen != pen) { |
|
351 | if (d_ptr->m_labelsPen != pen) { | |
352 | d_ptr->m_labelsPen = pen; |
|
352 | d_ptr->m_labelsPen = pen; | |
353 | emit d_ptr->updated(); |
|
353 | emit d_ptr->updated(); | |
354 | } |
|
354 | } | |
355 | } |
|
355 | } | |
356 |
|
356 | |||
357 | /*! |
|
357 | /*! | |
358 | Returns the pen used to labels. |
|
358 | Returns the pen used to labels. | |
359 | */ |
|
359 | */ | |
360 | QPen QAbstractAxis::labelsPen() const |
|
360 | QPen QAbstractAxis::labelsPen() const | |
361 | { |
|
361 | { | |
362 | return d_ptr->m_labelsPen; |
|
362 | return d_ptr->m_labelsPen; | |
363 | } |
|
363 | } | |
364 |
|
364 | |||
365 | /*! |
|
365 | /*! | |
366 | Sets \a brush used to draw labels. |
|
366 | Sets \a brush used to draw labels. | |
367 | */ |
|
367 | */ | |
368 | void QAbstractAxis::setLabelsBrush(const QBrush &brush) |
|
368 | void QAbstractAxis::setLabelsBrush(const QBrush &brush) | |
369 | { |
|
369 | { | |
370 | if (d_ptr->m_labelsBrush != brush) { |
|
370 | if (d_ptr->m_labelsBrush != brush) { | |
371 | d_ptr->m_labelsBrush = brush; |
|
371 | d_ptr->m_labelsBrush = brush; | |
372 | emit d_ptr->updated(); |
|
372 | emit d_ptr->updated(); | |
373 | } |
|
373 | } | |
374 | } |
|
374 | } | |
375 |
|
375 | |||
376 | /*! |
|
376 | /*! | |
377 | Returns brush used to draw labels. |
|
377 | Returns brush used to draw labels. | |
378 | */ |
|
378 | */ | |
379 | QBrush QAbstractAxis::labelsBrush() const |
|
379 | QBrush QAbstractAxis::labelsBrush() const | |
380 | { |
|
380 | { | |
381 | return d_ptr->m_labelsBrush; |
|
381 | return d_ptr->m_labelsBrush; | |
382 | } |
|
382 | } | |
383 |
|
383 | |||
384 | /*! |
|
384 | /*! | |
385 | Sets \a font used to draw labels. |
|
385 | Sets \a font used to draw labels. | |
386 | */ |
|
386 | */ | |
387 | void QAbstractAxis::setLabelsFont(const QFont &font) |
|
387 | void QAbstractAxis::setLabelsFont(const QFont &font) | |
388 | { |
|
388 | { | |
389 | if (d_ptr->m_labelsFont != font) { |
|
389 | if (d_ptr->m_labelsFont != font) { | |
390 | d_ptr->m_labelsFont = font; |
|
390 | d_ptr->m_labelsFont = font; | |
391 | emit d_ptr->updated(); |
|
391 | emit d_ptr->updated(); | |
392 | } |
|
392 | } | |
393 | } |
|
393 | } | |
394 |
|
394 | |||
395 | /*! |
|
395 | /*! | |
396 | Returns font used to draw labels. |
|
396 | Returns font used to draw labels. | |
397 | */ |
|
397 | */ | |
398 | QFont QAbstractAxis::labelsFont() const |
|
398 | QFont QAbstractAxis::labelsFont() const | |
399 | { |
|
399 | { | |
400 | return d_ptr->m_labelsFont; |
|
400 | return d_ptr->m_labelsFont; | |
401 | } |
|
401 | } | |
402 |
|
402 | |||
403 | void QAbstractAxis::setLabelsAngle(int angle) |
|
403 | void QAbstractAxis::setLabelsAngle(int angle) | |
404 | { |
|
404 | { | |
405 | if (d_ptr->m_labelsAngle != angle) { |
|
405 | if (d_ptr->m_labelsAngle != angle) { | |
406 | d_ptr->m_labelsAngle = angle; |
|
406 | d_ptr->m_labelsAngle = angle; | |
407 | emit d_ptr->updated(); |
|
407 | emit d_ptr->updated(); | |
408 | } |
|
408 | } | |
409 | } |
|
409 | } | |
410 |
|
410 | |||
411 | int QAbstractAxis::labelsAngle() const |
|
411 | int QAbstractAxis::labelsAngle() const | |
412 | { |
|
412 | { | |
413 | return d_ptr->m_labelsAngle; |
|
413 | return d_ptr->m_labelsAngle; | |
414 | } |
|
414 | } | |
415 |
|
415 | |||
416 | void QAbstractAxis::setLabelsColor(QColor color) |
|
416 | void QAbstractAxis::setLabelsColor(QColor color) | |
417 | { |
|
417 | { | |
418 | QBrush b = d_ptr->m_labelsBrush; |
|
418 | QBrush b = d_ptr->m_labelsBrush; | |
419 | if (b.color() != color) { |
|
419 | if (b.color() != color) { | |
420 | b.setColor(color); |
|
420 | b.setColor(color); | |
421 | setLabelsBrush(b); |
|
421 | setLabelsBrush(b); | |
422 | emit labelsColorChanged(color); |
|
422 | emit labelsColorChanged(color); | |
423 | } |
|
423 | } | |
424 | } |
|
424 | } | |
425 |
|
425 | |||
426 | QColor QAbstractAxis::labelsColor() const |
|
426 | QColor QAbstractAxis::labelsColor() const | |
427 | { |
|
427 | { | |
428 | return d_ptr->m_labelsBrush.color(); |
|
428 | return d_ptr->m_labelsBrush.color(); | |
429 | } |
|
429 | } | |
430 |
|
430 | |||
431 | void QAbstractAxis::setShadesVisible(bool visible) |
|
431 | void QAbstractAxis::setShadesVisible(bool visible) | |
432 | { |
|
432 | { | |
433 | if (d_ptr->m_shadesVisible != visible) { |
|
433 | if (d_ptr->m_shadesVisible != visible) { | |
434 | d_ptr->m_shadesVisible = visible; |
|
434 | d_ptr->m_shadesVisible = visible; | |
435 | emit d_ptr->updated(); |
|
435 | emit d_ptr->updated(); | |
436 | emit shadesVisibleChanged(visible); |
|
436 | emit shadesVisibleChanged(visible); | |
437 | } |
|
437 | } | |
438 | } |
|
438 | } | |
439 |
|
439 | |||
440 | bool QAbstractAxis::shadesVisible() const |
|
440 | bool QAbstractAxis::shadesVisible() const | |
441 | { |
|
441 | { | |
442 | return d_ptr->m_shadesVisible; |
|
442 | return d_ptr->m_shadesVisible; | |
443 | } |
|
443 | } | |
444 |
|
444 | |||
445 | /*! |
|
445 | /*! | |
446 | Sets \a pen used to draw shades. |
|
446 | Sets \a pen used to draw shades. | |
447 | */ |
|
447 | */ | |
448 | void QAbstractAxis::setShadesPen(const QPen &pen) |
|
448 | void QAbstractAxis::setShadesPen(const QPen &pen) | |
449 | { |
|
449 | { | |
450 | if (d_ptr->m_shadesPen != pen) { |
|
450 | if (d_ptr->m_shadesPen != pen) { | |
451 | d_ptr->m_shadesPen = pen; |
|
451 | d_ptr->m_shadesPen = pen; | |
452 | emit d_ptr->updated(); |
|
452 | emit d_ptr->updated(); | |
453 | } |
|
453 | } | |
454 | } |
|
454 | } | |
455 |
|
455 | |||
456 | /*! |
|
456 | /*! | |
457 | Returns pen used to draw shades. |
|
457 | Returns pen used to draw shades. | |
458 | */ |
|
458 | */ | |
459 | QPen QAbstractAxis::shadesPen() const |
|
459 | QPen QAbstractAxis::shadesPen() const | |
460 | { |
|
460 | { | |
461 | return d_ptr->m_shadesPen; |
|
461 | return d_ptr->m_shadesPen; | |
462 | } |
|
462 | } | |
463 |
|
463 | |||
464 | /*! |
|
464 | /*! | |
465 | Sets \a brush used to draw shades. |
|
465 | Sets \a brush used to draw shades. | |
466 | */ |
|
466 | */ | |
467 | void QAbstractAxis::setShadesBrush(const QBrush &brush) |
|
467 | void QAbstractAxis::setShadesBrush(const QBrush &brush) | |
468 | { |
|
468 | { | |
469 | if (d_ptr->m_shadesBrush != brush) { |
|
469 | if (d_ptr->m_shadesBrush != brush) { | |
470 | d_ptr->m_shadesBrush = brush; |
|
470 | d_ptr->m_shadesBrush = brush; | |
471 | emit d_ptr->updated(); |
|
471 | emit d_ptr->updated(); | |
472 | emit shadesColorChanged(brush.color()); |
|
472 | emit shadesColorChanged(brush.color()); | |
473 | } |
|
473 | } | |
474 | } |
|
474 | } | |
475 |
|
475 | |||
476 | /*! |
|
476 | /*! | |
477 | Returns brush used to draw shades. |
|
477 | Returns brush used to draw shades. | |
478 | */ |
|
478 | */ | |
479 | QBrush QAbstractAxis::shadesBrush() const |
|
479 | QBrush QAbstractAxis::shadesBrush() const | |
480 | { |
|
480 | { | |
481 | return d_ptr->m_shadesBrush; |
|
481 | return d_ptr->m_shadesBrush; | |
482 | } |
|
482 | } | |
483 |
|
483 | |||
484 | void QAbstractAxis::setShadesColor(QColor color) |
|
484 | void QAbstractAxis::setShadesColor(QColor color) | |
485 | { |
|
485 | { | |
486 | QBrush b = d_ptr->m_shadesBrush; |
|
486 | QBrush b = d_ptr->m_shadesBrush; | |
487 | b.setColor(color); |
|
487 | b.setColor(color); | |
488 | setShadesBrush(b); |
|
488 | setShadesBrush(b); | |
489 | } |
|
489 | } | |
490 |
|
490 | |||
491 | QColor QAbstractAxis::shadesColor() const |
|
491 | QColor QAbstractAxis::shadesColor() const | |
492 | { |
|
492 | { | |
493 | return d_ptr->m_shadesBrush.color(); |
|
493 | return d_ptr->m_shadesBrush.color(); | |
494 | } |
|
494 | } | |
495 |
|
495 | |||
496 | void QAbstractAxis::setShadesBorderColor(QColor color) |
|
496 | void QAbstractAxis::setShadesBorderColor(QColor color) | |
497 | { |
|
497 | { | |
498 | QPen p = d_ptr->m_shadesPen; |
|
498 | QPen p = d_ptr->m_shadesPen; | |
499 | p.setColor(color); |
|
499 | p.setColor(color); | |
500 | setShadesPen(p); |
|
500 | setShadesPen(p); | |
501 | } |
|
501 | } | |
502 |
|
502 | |||
503 | QColor QAbstractAxis::shadesBorderColor() const |
|
503 | QColor QAbstractAxis::shadesBorderColor() const | |
504 | { |
|
504 | { | |
505 | return d_ptr->m_shadesPen.color(); |
|
505 | return d_ptr->m_shadesPen.color(); | |
506 | } |
|
506 | } | |
507 |
|
507 | |||
508 |
|
508 | |||
509 | bool QAbstractAxis::isVisible() const |
|
509 | bool QAbstractAxis::isVisible() const | |
510 | { |
|
510 | { | |
511 | return d_ptr->m_visible; |
|
511 | return d_ptr->m_visible; | |
512 | } |
|
512 | } | |
513 |
|
513 | |||
514 | /*! |
|
514 | /*! | |
515 | Sets axis, shades, labels and grid lines to be visible. |
|
515 | Sets axis, shades, labels and grid lines to be visible. | |
516 | */ |
|
516 | */ | |
517 | void QAbstractAxis::setVisible(bool visible) |
|
517 | void QAbstractAxis::setVisible(bool visible) | |
518 | { |
|
518 | { | |
519 | if(d_ptr->m_visible!=visible){ |
|
519 | if(d_ptr->m_visible!=visible){ | |
520 | d_ptr->m_visible=visible; |
|
520 | d_ptr->m_visible=visible; | |
521 | emit visibleChanged(visible); |
|
521 | emit visibleChanged(visible); | |
522 | emit d_ptr->updated(); |
|
522 | emit d_ptr->updated(); | |
523 | } |
|
523 | } | |
524 | } |
|
524 | } | |
525 |
|
525 | |||
526 |
|
526 | |||
527 | /*! |
|
527 | /*! | |
528 | Sets axis, shades, labels and grid lines to be visible. |
|
528 | Sets axis, shades, labels and grid lines to be visible. | |
529 | */ |
|
529 | */ | |
530 | void QAbstractAxis::show() |
|
530 | void QAbstractAxis::show() | |
531 | { |
|
531 | { | |
532 | setVisible(true); |
|
532 | setVisible(true); | |
533 | } |
|
533 | } | |
534 |
|
534 | |||
535 | /*! |
|
535 | /*! | |
536 | Sets axis, shades, labels and grid lines to not be visible. |
|
536 | Sets axis, shades, labels and grid lines to not be visible. | |
537 | */ |
|
537 | */ | |
538 | void QAbstractAxis::hide() |
|
538 | void QAbstractAxis::hide() | |
539 | { |
|
539 | { | |
540 | setVisible(false); |
|
540 | setVisible(false); | |
541 | } |
|
541 | } | |
542 |
|
542 | |||
543 |
|
543 | /*! | ||
|
544 | Sets the minimum value shown on the axis. | |||
|
545 | Depending on the actual axis type the \a min paramter is converted to appropriate type. | |||
|
546 | If the conversion is impossible then the function call does nothing | |||
|
547 | */ | |||
544 | void QAbstractAxis::setMin(const QVariant &min) |
|
548 | void QAbstractAxis::setMin(const QVariant &min) | |
545 | { |
|
549 | { | |
546 | d_ptr->setMin(min); |
|
550 | d_ptr->setMin(min); | |
547 | } |
|
551 | } | |
|
552 | ||||
|
553 | /*! | |||
|
554 | Sets the maximum value shown on the axis. | |||
|
555 | Depending on the actual axis type the \a max paramter is converted to appropriate type. | |||
|
556 | If the conversion is impossible then the function call does nothing | |||
|
557 | */ | |||
548 | void QAbstractAxis::setMax(const QVariant &max) |
|
558 | void QAbstractAxis::setMax(const QVariant &max) | |
549 | { |
|
559 | { | |
550 | d_ptr->setMax(max); |
|
560 | d_ptr->setMax(max); | |
551 | } |
|
561 | } | |
|
562 | ||||
|
563 | /*! | |||
|
564 | Sets the range shown on the axis. | |||
|
565 | Depending on the actual axis type the \a min and \a max paramters are converted to appropriate types. | |||
|
566 | If the conversion is impossible then the function call does nothing. | |||
|
567 | */ | |||
552 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) |
|
568 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) | |
553 | { |
|
569 | { | |
554 | d_ptr->setRange(min,max); |
|
570 | d_ptr->setRange(min,max); | |
555 | } |
|
571 | } | |
556 |
|
572 | |||
557 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
573 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
558 |
|
574 | |||
559 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* q): |
|
575 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* q): | |
560 | q_ptr(q), |
|
576 | q_ptr(q), | |
561 | m_visible(false), |
|
577 | m_visible(false), | |
562 | m_axisVisible(true), |
|
578 | m_axisVisible(true), | |
563 | m_gridLineVisible(true), |
|
579 | m_gridLineVisible(true), | |
564 | m_labelsVisible(true), |
|
580 | m_labelsVisible(true), | |
565 | m_labelsAngle(0), |
|
581 | m_labelsAngle(0), | |
566 | m_shadesVisible(false), |
|
582 | m_shadesVisible(false), | |
567 | m_shadesBrush(Qt::SolidPattern), |
|
583 | m_shadesBrush(Qt::SolidPattern), | |
568 | m_shadesOpacity(1.0), |
|
584 | m_shadesOpacity(1.0), | |
569 | m_orientation(Qt::Orientation(0)), |
|
585 | m_orientation(Qt::Orientation(0)), | |
570 | m_min(0), |
|
586 | m_min(0), | |
571 | m_max(0), |
|
587 | m_max(0), | |
572 | m_ticksCount(5) |
|
588 | m_ticksCount(5) | |
573 | { |
|
589 | { | |
574 |
|
590 | |||
575 | } |
|
591 | } | |
576 |
|
592 | |||
577 | QAbstractAxisPrivate::~QAbstractAxisPrivate() |
|
593 | QAbstractAxisPrivate::~QAbstractAxisPrivate() | |
578 | { |
|
594 | { | |
579 |
|
595 | |||
580 | } |
|
596 | } | |
581 |
|
597 | |||
582 | #include "moc_qabstractaxis.cpp" |
|
598 | #include "moc_qabstractaxis.cpp" | |
583 | #include "moc_qabstractaxis_p.cpp" |
|
599 | #include "moc_qabstractaxis_p.cpp" | |
584 |
|
600 | |||
585 | QTCOMMERCIALCHART_END_NAMESPACE |
|
601 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now