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