##// END OF EJS Templates
Fix missing unbind call in destrutor in scatter series
Michal Klocek -
r1270:8cad7c5eba8c
parent child
Show More
@@ -1,151 +1,155
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qscatterseries.h"
22 22 #include "qscatterseries_p.h"
23 23 #include "scatterchartitem_p.h"
24 24 #include "chartdataset_p.h"
25 25 #include "charttheme_p.h"
26 26 #include "chartanimator_p.h"
27 27
28 28 /*!
29 29 \class QScatterSeries
30 30 \brief The QScatterSeries class is used for making scatter charts.
31 31
32 32 \mainclass
33 33
34 34 The scatter data is displayed as a collection of points on the chart. Each point determines the position on the horizontal axis
35 35 and the vertical axis.
36 36
37 37 \image examples_scatterchart.png
38 38
39 39 Creating basic scatter chart is simple:
40 40 \code
41 41 QScatterSeries* series = new QScatterSeries();
42 42 series->append(0, 6);
43 43 series->append(2, 4);
44 44 ...
45 45 chart->addSeries(series);
46 46 \endcode
47 47 */
48 48
49 49 /*!
50 50 \enum QScatterSeries::MarkerShape
51 51
52 52 This enum describes the shape used when rendering marker items.
53 53
54 54 \value MarkerShapeCircle
55 55 \value MarkerShapeRectangle
56 56 */
57 57
58 58 /*!
59 59 \fn QChartSeriesType QScatterSeries::type() const
60 60 \brief Returns QChartSeries::SeriesTypeScatter.
61 61 \sa QAbstractSeries, SeriesType
62 62 */
63 63
64 64 QTCOMMERCIALCHART_BEGIN_NAMESPACE
65 65
66 66 /*!
67 67 Constructs a series object which is a child of \a parent.
68 68 */
69 69 QScatterSeries::QScatterSeries(QObject *parent) : QXYSeries(*new QScatterSeriesPrivate(this),parent)
70 70 {
71 71 }
72 72
73 73 /*!
74 74 Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
75 75 */
76 76 QScatterSeries::~QScatterSeries()
77 77 {
78 Q_D(QScatterSeries);
79 if(d->m_dataset) {
80 d->m_dataset->removeSeries(this);
81 }
78 82 }
79 83
80 84 QAbstractSeries::SeriesType QScatterSeries::type() const
81 85 {
82 86 return QAbstractSeries::SeriesTypeScatter;
83 87 }
84 88
85 89 /*!
86 90 Returns the shape used for drawing markers.
87 91 */
88 92 QScatterSeries::MarkerShape QScatterSeries::shape() const
89 93 {
90 94 Q_D(const QScatterSeries);
91 95 return d->m_shape;
92 96 }
93 97
94 98 /*!
95 99 Overrides the default shape of the marker items with a user defined \a shape. The default shape
96 100 is defined by chart theme setting.
97 101 */
98 102 void QScatterSeries::setShape(MarkerShape shape)
99 103 {
100 104 Q_D(QScatterSeries);
101 105 if (d->m_shape != shape) {
102 106 d->m_shape = shape;
103 107 emit d->updated();
104 108 }
105 109 }
106 110
107 111 /*!
108 112 Returns the size of the marker items.
109 113 */
110 114 qreal QScatterSeries::size() const
111 115 {
112 116 Q_D(const QScatterSeries);
113 117 return d->m_size;
114 118 }
115 119
116 120 /*!
117 121 Set the \a size of the marker items. The default size is 15.
118 122 */
119 123 void QScatterSeries::setSize(qreal size)
120 124 {
121 125 Q_D(QScatterSeries);
122 126
123 127 if (!qFuzzyIsNull(d->m_size - size)) {
124 128 d->m_size = size;
125 129 emit d->updated();
126 130 }
127 131 }
128 132
129 133 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
130 134
131 135 QScatterSeriesPrivate::QScatterSeriesPrivate(QScatterSeries* q):QXYSeriesPrivate(q),
132 136 m_shape(QScatterSeries::MarkerShapeCircle),
133 137 m_size(15.0)
134 138 {
135 139
136 140 };
137 141
138 142 Chart* QScatterSeriesPrivate::createGraphics(ChartPresenter* presenter)
139 143 {
140 144 Q_Q(QScatterSeries);
141 145 ScatterChartItem *scatter = new ScatterChartItem(q,presenter);
142 146 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
143 147 scatter->setAnimator(presenter->animator());
144 148 scatter->setAnimation(new XYAnimation(scatter));
145 149 }
146 150 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
147 151 return scatter;
148 152 }
149 153
150 154
151 155 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now