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