@@ -1,462 +1,497 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Charts module. |
|
8 | 8 | ** |
|
9 | 9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
10 | 10 | ** accordance with the Qt License Agreement provided with the Software |
|
11 | 11 | ** or, alternatively, in accordance with the terms contained in a written |
|
12 | 12 | ** agreement between you and The Qt Company. |
|
13 | 13 | ** |
|
14 | 14 | ** If you have questions regarding the use of this file, please use |
|
15 | 15 | ** contact form at http://qt.io |
|
16 | 16 | ** |
|
17 | 17 | ****************************************************************************/ |
|
18 | 18 | |
|
19 | 19 | #include <QtCharts/QAbstractSeries> |
|
20 | 20 | #include <private/qabstractseries_p.h> |
|
21 | 21 | #include <private/chartdataset_p.h> |
|
22 | 22 | #include <QtCharts/QChart> |
|
23 | 23 | #include <private/qchart_p.h> |
|
24 | 24 | #include <private/chartitem_p.h> |
|
25 | 25 | #include <private/xydomain_p.h> |
|
26 | 26 | #include <private/xlogydomain_p.h> |
|
27 | 27 | #include <private/logxydomain_p.h> |
|
28 | 28 | #include <private/logxlogydomain_p.h> |
|
29 | 29 | |
|
30 | 30 | QT_CHARTS_BEGIN_NAMESPACE |
|
31 | 31 | |
|
32 | 32 | /*! |
|
33 | 33 | \class QAbstractSeries |
|
34 | 34 | \inmodule Qt Charts |
|
35 | 35 | \brief Base class for all Qt Chart series. |
|
36 | 36 | |
|
37 | 37 | Usually you use the series type specific inherited classes instead of the base class. |
|
38 | 38 | \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries, |
|
39 | 39 | QPercentBarSeries, QPieSeries |
|
40 | 40 | */ |
|
41 | 41 | /*! |
|
42 | 42 | \qmltype AbstractSeries |
|
43 | 43 | \instantiates QAbstractSeries |
|
44 | 44 | \inqmlmodule QtCharts |
|
45 | 45 | |
|
46 | 46 | \brief Base class for all Qt Chart series. |
|
47 | 47 | |
|
48 | 48 | AbstractSeries is the base class for all series. |
|
49 | 49 | The class cannot be instantiated by the user. |
|
50 | 50 | */ |
|
51 | 51 | |
|
52 | 52 | /*! |
|
53 | 53 | \enum QAbstractSeries::SeriesType |
|
54 | 54 | |
|
55 | 55 | The type of the series object. |
|
56 | 56 | |
|
57 | 57 | \value SeriesTypeLine |
|
58 | 58 | \value SeriesTypeArea |
|
59 | 59 | \value SeriesTypeBar |
|
60 | 60 | \value SeriesTypeStackedBar |
|
61 | 61 | \value SeriesTypePercentBar |
|
62 | 62 | \value SeriesTypePie |
|
63 | 63 | \value SeriesTypeScatter |
|
64 | 64 | \value SeriesTypeSpline |
|
65 | 65 | \value SeriesTypeHorizontalBar |
|
66 | 66 | \value SeriesTypeHorizontalStackedBar |
|
67 | 67 | \value SeriesTypeHorizontalPercentBar |
|
68 | 68 | \value SeriesTypeBoxPlot |
|
69 | 69 | */ |
|
70 | 70 | |
|
71 | 71 | /*! |
|
72 | 72 | \property QAbstractSeries::type |
|
73 | 73 | The type of the series. |
|
74 | 74 | */ |
|
75 | 75 | /*! |
|
76 | 76 | \qmlproperty ChartView.SeriesType AbstractSeries::type |
|
77 | 77 | The type of the series. |
|
78 | 78 | */ |
|
79 | 79 | |
|
80 | 80 | /*! |
|
81 | 81 | \property QAbstractSeries::name |
|
82 | 82 | \brief name of the series property. The name is shown in legend for series and supports html formatting. |
|
83 | 83 | */ |
|
84 | 84 | /*! |
|
85 | 85 | \qmlproperty string AbstractSeries::name |
|
86 | 86 | Name of the series. The name is shown in legend for series and supports html formatting. |
|
87 | 87 | */ |
|
88 | 88 | |
|
89 | 89 | /*! |
|
90 | 90 | \fn void QAbstractSeries::nameChanged() |
|
91 | 91 | This signal is emitted when the series name changes. |
|
92 | 92 | */ |
|
93 | 93 | /*! |
|
94 | 94 | \qmlsignal AbstractSeries::onNameChanged() |
|
95 | 95 | This signal is emitted when the series name changes. |
|
96 | 96 | */ |
|
97 | 97 | |
|
98 | 98 | /*! |
|
99 | 99 | \property QAbstractSeries::visible |
|
100 | 100 | \brief whether the series is visible or not; true by default. |
|
101 | 101 | */ |
|
102 | 102 | /*! |
|
103 | 103 | \qmlproperty bool AbstractSeries::visible |
|
104 | 104 | Visibility of the series. True by default. |
|
105 | 105 | */ |
|
106 | 106 | |
|
107 | 107 | /*! |
|
108 | 108 | \fn void QAbstractSeries::visibleChanged() |
|
109 | 109 | Emitted when the series visibility changes. |
|
110 | 110 | */ |
|
111 | 111 | /*! |
|
112 | 112 | \qmlsignal AbstractSeries::onVisibleChanged() |
|
113 | 113 | Emitted when the series visibility changes. |
|
114 | 114 | */ |
|
115 | 115 | |
|
116 | 116 | /*! |
|
117 | 117 | \property QAbstractSeries::opacity |
|
118 | 118 | \brief The opacity of the series. |
|
119 | 119 | |
|
120 | 120 | By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque). |
|
121 | 121 | */ |
|
122 | 122 | /*! |
|
123 | 123 | \qmlproperty real AbstractSeries::opacity |
|
124 | 124 | The opacity of the series. By default the opacity is 1.0. |
|
125 | 125 | The valid values range from 0.0 (transparent) to 1.0 (opaque). |
|
126 | 126 | */ |
|
127 | 127 | |
|
128 | 128 | /*! |
|
129 | 129 | \fn void QAbstractSeries::opacityChanged() |
|
130 | 130 | Emitted when the opacity of the series changes. |
|
131 | 131 | */ |
|
132 | 132 | /*! |
|
133 | 133 | \qmlsignal AbstractSeries::onOpacityChanged() |
|
134 | 134 | Emitted when the opacity of the series changes. |
|
135 | 135 | */ |
|
136 | 136 | |
|
137 | 137 | /*! |
|
138 | 138 | \property QAbstractSeries::useOpenGL |
|
139 | 139 | \brief Specifies whether or not the series drawing is accelerated with OpenGL. |
|
140 | 140 | |
|
141 | 141 | Drawing series with OpenGL is supported only for QLineSeries and QScatterSeries. |
|
142 | 142 | Line series used as edge series for a QAreaSeries cannot use OpenGL acceleration. |
|
143 | 143 | When a chart contains any series that are drawn with OpenGL, a transparent QOpenGLWidget |
|
144 |
is created on top of the chart plot area. |
|
|
144 | is created on top of the chart plot area. The accelerated series are not drawn on the underlying | |
|
145 | 145 | QGraphicsView, but are instead drawn on the created QOpenGLWidget. |
|
146 | 146 | |
|
147 | 147 | Performance gained from using OpenGL to accelerate series drawing depends on the underlying |
|
148 | 148 | hardware, but in most cases it is significant. For example, on a standard desktop computer, |
|
149 | 149 | enabling OpenGL acceleration for a series typically allows rendering at least hundred times |
|
150 | 150 | more points without reduction on the frame rate. |
|
151 | 151 | Chart size also has less effect on the frame rate. |
|
152 | 152 | |
|
153 | 153 | The OpenGL acceleration of series drawing is meant for use cases that need fast drawing of |
|
154 | 154 | large numbers of points. It is optimized for efficiency, and therefore the series using |
|
155 |
it lack support for |
|
|
156 | ||
|
157 | There are the following restrictions imposed on charts and series when using OpenGL | |
|
158 | acceleration: | |
|
155 | it lack support for many features available to non-accelerated series: | |
|
159 | 156 | |
|
160 | 157 | \list |
|
161 | 158 | \li Series animations are not supported for accelerated series. |
|
162 | 159 | \li Antialiasing is not supported for accelerated series. |
|
163 | 160 | \li Point labels are not supported for accelerated series. |
|
164 | 161 | \li Pen styles and marker shapes are ignored for accelerated series. |
|
165 | 162 | Only solid lines and plain scatter dots are supported. |
|
166 | 163 | The scatter dots may be circular or rectangular, depending on the underlying graphics |
|
167 | 164 | hardware and drivers. |
|
168 |
\li Polar charts |
|
|
165 | \li Polar charts do not support accelerated series. | |
|
169 | 166 | \li Mouse events are not supported for accelerated series. |
|
170 | \li Since the accelerated series are drawn on top of the entire graphics view, they get drawn | |
|
171 | on top of any other graphics items that you may have on top chart in the same scene. | |
|
172 | \li To enable QOpenGLWidget to be partially transparent, it needs to be stacked on top of | |
|
173 | all other widgets. This means you cannot have other widgets partially covering the | |
|
174 | chart. | |
|
175 | 167 | \li Enabling chart drop shadow is not recommended when using accelerated series, |
|
176 | 168 | as that can slow the frame rate down significantly. |
|
177 | 169 | \endlist |
|
178 | 170 | |
|
171 | These additional restrictions stem from the fact that the accelerated series is drawn on a | |
|
172 | separate widget on top of the chart: | |
|
173 | ||
|
174 | \list | |
|
175 | \li If you draw any graphics items on top of a chart containing an accelerated series, | |
|
176 | the accelerated series is drawn over those items. | |
|
177 | \li To enable QOpenGLWidget to be partially transparent, it needs to be stacked on top of | |
|
178 | all other widgets. This means you cannot have other widgets partially covering the | |
|
179 | chart when using accelerated series. | |
|
180 | \li Accelerated series are not supported for use cases where the graphics scene has more than | |
|
181 | one graphics view attached to it. | |
|
182 | \li Accelerated series are not supported for use cases where the chart doesn't fill the entire | |
|
183 | graphics view or has non-default geometry. For example, scrolling the view with scroll | |
|
184 | bars or adding transformations to the graphics view cause the accelerated series to | |
|
185 | be drawn in incorrect position related to the chart. | |
|
186 | \endlist | |
|
187 | ||
|
179 | 188 | The default value is \c{false}. |
|
180 | 189 | */ |
|
181 | 190 | /*! |
|
182 | 191 | \qmlproperty bool AbstractSeries::useOpenGL |
|
183 | 192 | Specifies whether or not the series is drawn with OpenGL. |
|
184 | 193 | |
|
185 | 194 | Drawing series with OpenGL is supported only for LineSeries and ScatterSeries. |
|
195 | Line series used as edge series for a AreaSeries cannot use OpenGL acceleration. | |
|
196 | When a chart contains any series that are drawn with OpenGL, an additional transparent child | |
|
197 | node is created for the ChartView node. The accelerated series are not drawn on the | |
|
198 | ChartView node, but are instead drawn on the child node. | |
|
199 | ||
|
200 | Performance gained from using OpenGL to accelerate series drawing depends on the underlying | |
|
201 | hardware, but in most cases it is significant. For example, on a standard desktop computer, | |
|
202 | enabling OpenGL acceleration for a series typically allows rendering at least hundred times | |
|
203 | more points without reduction on the frame rate. | |
|
204 | Chart size also has less effect on the frame rate. | |
|
205 | The biggest performance sink when rendering ChartView is rendering and uploading the underlying | |
|
206 | chart texture. If the underlying chart itself is not changing rapidly, significant extra | |
|
207 | performance is gained from not needing to regenerate the chart texture for each frame. | |
|
208 | ||
|
209 | The OpenGL acceleration of series drawing is meant for use cases that need fast drawing of | |
|
210 | large numbers of points. It is optimized for efficiency, and therefore the series using | |
|
211 | it lack support for many features available to non-accelerated series: | |
|
186 | 212 | |
|
187 | For more details, see QAbstractSeries::useOpenGL documentation. QML applications have similar | |
|
188 | restrictions as those listed in QAbstractSeries::useOpenGL documentation, | |
|
189 | except there is no restriction about covering the ChartView partially with other | |
|
190 | items due to different rendering mechanism. | |
|
213 | \list | |
|
214 | \li Series animations are not supported for accelerated series. | |
|
215 | \li Antialiasing is not supported for accelerated series. | |
|
216 | \li Point labels are not supported for accelerated series. | |
|
217 | \li Marker shapes are ignored for accelerated series. | |
|
218 | Only plain scatter dots are supported. | |
|
219 | The scatter dots may be circular or rectangular, depending on the underlying graphics | |
|
220 | hardware and drivers. | |
|
221 | \li Polar charts do not support accelerated series. | |
|
222 | \li Mouse events are not supported for accelerated series. | |
|
223 | \li Enabling chart drop shadow is not recommended when using accelerated series, | |
|
224 | as that can slow the frame rate down significantly. | |
|
225 | \endlist | |
|
191 | 226 | |
|
192 | 227 | The default value is \c{false}. |
|
193 | 228 | */ |
|
194 | 229 | |
|
195 | 230 | /*! |
|
196 | 231 | \fn void QAbstractSeries::useOpenGLChanged() |
|
197 | 232 | Emitted when the useOpenGL property value changes. |
|
198 | 233 | */ |
|
199 | 234 | /*! |
|
200 | 235 | \qmlsignal AbstractSeries::onUseOpenGLChanged() |
|
201 | 236 | Emitted when the useOpenGL property value changes. |
|
202 | 237 | */ |
|
203 | 238 | |
|
204 | 239 | /*! |
|
205 | 240 | \internal |
|
206 | 241 | \brief Constructs QAbstractSeries object with \a parent. |
|
207 | 242 | */ |
|
208 | 243 | QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) : |
|
209 | 244 | QObject(parent), |
|
210 | 245 | d_ptr(&d) |
|
211 | 246 | { |
|
212 | 247 | } |
|
213 | 248 | |
|
214 | 249 | /*! |
|
215 | 250 | \brief Virtual destructor for the chart series. |
|
216 | 251 | */ |
|
217 | 252 | QAbstractSeries::~QAbstractSeries() |
|
218 | 253 | { |
|
219 | 254 | if (d_ptr->m_chart) |
|
220 | 255 | qFatal("Series still bound to a chart when destroyed!"); |
|
221 | 256 | } |
|
222 | 257 | |
|
223 | 258 | void QAbstractSeries::setName(const QString &name) |
|
224 | 259 | { |
|
225 | 260 | if (name != d_ptr->m_name) { |
|
226 | 261 | d_ptr->m_name = name; |
|
227 | 262 | emit nameChanged(); |
|
228 | 263 | } |
|
229 | 264 | } |
|
230 | 265 | |
|
231 | 266 | QString QAbstractSeries::name() const |
|
232 | 267 | { |
|
233 | 268 | return d_ptr->m_name; |
|
234 | 269 | } |
|
235 | 270 | |
|
236 | 271 | void QAbstractSeries::setVisible(bool visible) |
|
237 | 272 | { |
|
238 | 273 | if (visible != d_ptr->m_visible) { |
|
239 | 274 | d_ptr->m_visible = visible; |
|
240 | 275 | emit visibleChanged(); |
|
241 | 276 | } |
|
242 | 277 | } |
|
243 | 278 | |
|
244 | 279 | bool QAbstractSeries::isVisible() const |
|
245 | 280 | { |
|
246 | 281 | return d_ptr->m_visible; |
|
247 | 282 | } |
|
248 | 283 | |
|
249 | 284 | qreal QAbstractSeries::opacity() const |
|
250 | 285 | { |
|
251 | 286 | return d_ptr->m_opacity; |
|
252 | 287 | } |
|
253 | 288 | |
|
254 | 289 | void QAbstractSeries::setOpacity(qreal opacity) |
|
255 | 290 | { |
|
256 | 291 | if (opacity != d_ptr->m_opacity) { |
|
257 | 292 | d_ptr->m_opacity = opacity; |
|
258 | 293 | emit opacityChanged(); |
|
259 | 294 | } |
|
260 | 295 | } |
|
261 | 296 | |
|
262 | 297 | void QAbstractSeries::setUseOpenGL(bool enable) |
|
263 | 298 | { |
|
264 | 299 | #ifdef QT_NO_OPENGL |
|
265 | 300 | Q_UNUSED(enable) |
|
266 | 301 | #else |
|
267 | 302 | bool polarChart = d_ptr->m_chart && d_ptr->m_chart->chartType() == QChart::ChartTypePolar; |
|
268 | 303 | bool supportedSeries = (type() == SeriesTypeLine || type() == SeriesTypeScatter); |
|
269 | 304 | if ((!enable || !d_ptr->m_blockOpenGL) |
|
270 | 305 | && supportedSeries |
|
271 | 306 | && enable != d_ptr->m_useOpenGL |
|
272 | 307 | && (!enable || !polarChart)) { |
|
273 | 308 | d_ptr->m_useOpenGL = enable; |
|
274 | 309 | emit useOpenGLChanged(); |
|
275 | 310 | } |
|
276 | 311 | #endif |
|
277 | 312 | } |
|
278 | 313 | |
|
279 | 314 | bool QAbstractSeries::useOpenGL() const |
|
280 | 315 | { |
|
281 | 316 | return d_ptr->m_useOpenGL; |
|
282 | 317 | } |
|
283 | 318 | |
|
284 | 319 | /*! |
|
285 | 320 | \brief Returns the chart where series belongs to. |
|
286 | 321 | |
|
287 | 322 | Set automatically when the series is added to the chart |
|
288 | 323 | and unset when the series is removed from the chart. |
|
289 | 324 | */ |
|
290 | 325 | QChart *QAbstractSeries::chart() const |
|
291 | 326 | { |
|
292 | 327 | return d_ptr->m_chart; |
|
293 | 328 | } |
|
294 | 329 | |
|
295 | 330 | /*! |
|
296 | 331 | \brief Sets the visibility of the series to true. |
|
297 | 332 | |
|
298 | 333 | \sa setVisible(), isVisible() |
|
299 | 334 | */ |
|
300 | 335 | void QAbstractSeries::show() |
|
301 | 336 | { |
|
302 | 337 | setVisible(true); |
|
303 | 338 | } |
|
304 | 339 | |
|
305 | 340 | /*! |
|
306 | 341 | \brief Sets the visibility of the series to false. |
|
307 | 342 | |
|
308 | 343 | \sa setVisible(), isVisible() |
|
309 | 344 | */ |
|
310 | 345 | void QAbstractSeries::hide() |
|
311 | 346 | { |
|
312 | 347 | setVisible(false); |
|
313 | 348 | } |
|
314 | 349 | |
|
315 | 350 | /*! |
|
316 | 351 | Attach \a axis to the series. |
|
317 | 352 | \return true if the axis was attached successfully, false otherwise. |
|
318 | 353 | \note If multiple axes of same orientation are attached to same series, |
|
319 | 354 | they will have same min/max ranges. |
|
320 | 355 | \sa QChart::addAxis(), QChart::createDefaultAxes() |
|
321 | 356 | */ |
|
322 | 357 | bool QAbstractSeries::attachAxis(QAbstractAxis* axis) |
|
323 | 358 | { |
|
324 | 359 | if(d_ptr->m_chart) { |
|
325 | 360 | return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis); |
|
326 | 361 | } else { |
|
327 | 362 | qWarning()<<"Series not in the chart. Please addSeries to chart first."; |
|
328 | 363 | return false; |
|
329 | 364 | } |
|
330 | 365 | } |
|
331 | 366 | |
|
332 | 367 | /*! |
|
333 | 368 | Detach \a axis from the series. |
|
334 | 369 | \return true if the axis was detached successfully, false otherwise. |
|
335 | 370 | \sa QChart::removeAxis() |
|
336 | 371 | */ |
|
337 | 372 | bool QAbstractSeries::detachAxis(QAbstractAxis* axis) |
|
338 | 373 | { |
|
339 | 374 | if(d_ptr->m_chart) { |
|
340 | 375 | return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis); |
|
341 | 376 | } |
|
342 | 377 | else { |
|
343 | 378 | qWarning()<<"Series not in the chart. Please addSeries to chart first."; |
|
344 | 379 | return false; |
|
345 | 380 | } |
|
346 | 381 | } |
|
347 | 382 | |
|
348 | 383 | /*! |
|
349 | 384 | Returns the list of axes attached to the series. Usually there is an x-axis and a y-axis attached to a series, except |
|
350 | 385 | in case of a QPieSeries, which does not have any axes attached. |
|
351 | 386 | \sa attachAxis(), detachAxis() |
|
352 | 387 | */ |
|
353 | 388 | QList<QAbstractAxis*> QAbstractSeries::attachedAxes() |
|
354 | 389 | { |
|
355 | 390 | return d_ptr->m_axes; |
|
356 | 391 | } |
|
357 | 392 | |
|
358 | 393 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
359 | 394 | |
|
360 | 395 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q) |
|
361 | 396 | : q_ptr(q), |
|
362 | 397 | m_chart(0), |
|
363 | 398 | m_item(0), |
|
364 | 399 | m_domain(new XYDomain()), |
|
365 | 400 | m_visible(true), |
|
366 | 401 | m_opacity(1.0), |
|
367 | 402 | m_useOpenGL(false), |
|
368 | 403 | m_blockOpenGL(false) |
|
369 | 404 | { |
|
370 | 405 | } |
|
371 | 406 | |
|
372 | 407 | QAbstractSeriesPrivate::~QAbstractSeriesPrivate() |
|
373 | 408 | { |
|
374 | 409 | } |
|
375 | 410 | |
|
376 | 411 | void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain) |
|
377 | 412 | { |
|
378 | 413 | Q_ASSERT(domain); |
|
379 | 414 | if(m_domain.data()!=domain) { |
|
380 | 415 | if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated())); |
|
381 | 416 | m_domain.reset(domain); |
|
382 | 417 | if(!m_item.isNull()) { |
|
383 | 418 | QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); |
|
384 | 419 | m_item->handleDomainUpdated(); |
|
385 | 420 | } |
|
386 | 421 | } |
|
387 | 422 | } |
|
388 | 423 | |
|
389 | 424 | void QAbstractSeriesPrivate::setPresenter(ChartPresenter *presenter) |
|
390 | 425 | { |
|
391 | 426 | m_presenter = presenter; |
|
392 | 427 | } |
|
393 | 428 | |
|
394 | 429 | ChartPresenter *QAbstractSeriesPrivate::presenter() const |
|
395 | 430 | { |
|
396 | 431 | return m_presenter; |
|
397 | 432 | } |
|
398 | 433 | |
|
399 | 434 | void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent) |
|
400 | 435 | { |
|
401 | 436 | Q_ASSERT(!m_item.isNull()); |
|
402 | 437 | Q_UNUSED(parent); |
|
403 | 438 | QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); |
|
404 | 439 | } |
|
405 | 440 | |
|
406 | 441 | void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, |
|
407 | 442 | QEasingCurve &curve) |
|
408 | 443 | { |
|
409 | 444 | Q_UNUSED(options); |
|
410 | 445 | Q_UNUSED(duration); |
|
411 | 446 | Q_UNUSED(curve); |
|
412 | 447 | } |
|
413 | 448 | |
|
414 | 449 | bool QAbstractSeriesPrivate::reverseXAxis() |
|
415 | 450 | { |
|
416 | 451 | bool reverseXAxis = false; |
|
417 | 452 | if (m_axes.size() != 0 && !(m_chart->chartType() == QChart::ChartTypePolar)) { |
|
418 | 453 | int i = 0; |
|
419 | 454 | while (i < m_axes.size()) { |
|
420 | 455 | if (m_axes.at(i)->orientation() == Qt::Horizontal && m_axes.at(i)->isReverse()) { |
|
421 | 456 | reverseXAxis = true; |
|
422 | 457 | break; |
|
423 | 458 | } |
|
424 | 459 | i++; |
|
425 | 460 | } |
|
426 | 461 | } |
|
427 | 462 | |
|
428 | 463 | return reverseXAxis; |
|
429 | 464 | } |
|
430 | 465 | |
|
431 | 466 | bool QAbstractSeriesPrivate::reverseYAxis() |
|
432 | 467 | { |
|
433 | 468 | bool reverseYAxis = false; |
|
434 | 469 | if (m_axes.size() != 0 && !(m_chart->chartType() == QChart::ChartTypePolar)) { |
|
435 | 470 | int i = 0; |
|
436 | 471 | while (i < m_axes.size()) { |
|
437 | 472 | if (m_axes.at(i)->orientation() == Qt::Vertical && m_axes.at(i)->isReverse()) { |
|
438 | 473 | reverseYAxis = true; |
|
439 | 474 | break; |
|
440 | 475 | } |
|
441 | 476 | i++; |
|
442 | 477 | } |
|
443 | 478 | } |
|
444 | 479 | |
|
445 | 480 | return reverseYAxis; |
|
446 | 481 | } |
|
447 | 482 | |
|
448 | 483 | // This function can be used to explicitly block OpenGL use from some otherwise supported series, |
|
449 | 484 | // such as the line series used as edge series of an area series. |
|
450 | 485 | void QAbstractSeriesPrivate::setBlockOpenGL(bool enable) |
|
451 | 486 | { |
|
452 | 487 | m_blockOpenGL = enable; |
|
453 | 488 | if (enable) |
|
454 | 489 | q_ptr->setUseOpenGL(false); |
|
455 | 490 | } |
|
456 | 491 | |
|
457 | 492 | #include "moc_qabstractseries.cpp" |
|
458 | 493 | #include "moc_qabstractseries_p.cpp" |
|
459 | 494 | |
|
460 | 495 | QT_CHARTS_END_NAMESPACE |
|
461 | 496 | |
|
462 | 497 |
General Comments 0
You need to be logged in to leave comments.
Login now