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