##// END OF EJS Templates
color and borderColor properties to XY charts; removed unnecessary signals
Tero Ahola -
r1481:3fafc6aab8aa
parent child
Show More
@@ -64,30 +64,6 DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const
64 64 return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
65 65 }
66 66
67 QColor DeclarativeAreaSeries::penColor() const
68 {
69 return pen().color();
70 }
71
72 void DeclarativeAreaSeries::setPenColor(QColor color)
73 {
74 QPen p = pen();
75 p.setColor(color);
76 setPen(p);
77 }
78
79 QColor DeclarativeAreaSeries::brushColor() const
80 {
81 return brush().color();
82 }
83
84 void DeclarativeAreaSeries::setBrushColor(QColor color)
85 {
86 QBrush b = brush();
87 b.setColor(color);
88 setBrush(b);
89 }
90
91 67 #include "moc_declarativeareaseries.cpp"
92 68
93 69 QTCOMMERCIALCHART_END_NAMESPACE
@@ -32,8 +32,6 class DeclarativeAreaSeries : public QAreaSeries
32 32 Q_OBJECT
33 33 Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
34 34 Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
35 Q_PROPERTY(QColor color READ brushColor WRITE setBrushColor)
36 Q_PROPERTY(QColor borderColor READ penColor WRITE setPenColor)
37 35
38 36 public:
39 37 explicit DeclarativeAreaSeries(QObject *parent = 0);
@@ -41,10 +39,6 public:
41 39 DeclarativeLineSeries* upperSeries() const;
42 40 void setLowerSeries(DeclarativeLineSeries* series);
43 41 DeclarativeLineSeries* lowerSeries() const;
44 QColor penColor() const;
45 void setPenColor(QColor color);
46 QColor brushColor() const;
47 void setBrushColor(QColor color);
48 42 };
49 43
50 44 QTCOMMERCIALCHART_END_NAMESPACE
@@ -160,10 +160,8 void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *
160 160 void DeclarativeChart::setTheme(DeclarativeChart::Theme theme)
161 161 {
162 162 QChart::ChartTheme chartTheme = (QChart::ChartTheme) theme;
163 if (chartTheme != m_chart->theme()) {
163 if (chartTheme != m_chart->theme())
164 164 m_chart->setTheme(chartTheme);
165 themeChanged();
166 }
167 165 }
168 166
169 167 DeclarativeChart::Theme DeclarativeChart::theme()
@@ -174,10 +172,8 DeclarativeChart::Theme DeclarativeChart::theme()
174 172 void DeclarativeChart::setAnimationOptions(DeclarativeChart::Animation animations)
175 173 {
176 174 QChart::AnimationOption animationOptions = (QChart::AnimationOption) animations;
177 if (animationOptions != m_chart->animationOptions()) {
175 if (animationOptions != m_chart->animationOptions())
178 176 m_chart->setAnimationOptions(animationOptions);
179 animationOptionsChanged();
180 }
181 177 }
182 178
183 179 DeclarativeChart::Animation DeclarativeChart::animationOptions()
@@ -194,10 +190,8 DeclarativeChart::Animation DeclarativeChart::animationOptions()
194 190
195 191 void DeclarativeChart::setTitle(QString title)
196 192 {
197 if (title != m_chart->title()) {
193 if (title != m_chart->title())
198 194 m_chart->setTitle(title);
199 emit titleChanged();
200 }
201 195 }
202 196 QString DeclarativeChart::title()
203 197 {
@@ -34,9 +34,9 class DeclarativeChart : public QDeclarativeItem
34 34 //class DeclarativeChart : public QQuickPaintedItem, public Chart
35 35 {
36 36 Q_OBJECT
37 Q_PROPERTY(Theme theme READ theme WRITE setTheme NOTIFY themeChanged)
38 Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions NOTIFY animationOptionsChanged)
39 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
37 Q_PROPERTY(Theme theme READ theme WRITE setTheme)
38 Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions)
39 Q_PROPERTY(QString title READ title WRITE setTitle)
40 40 Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged)
41 41 Q_PROPERTY(QAxis *axisX READ axisX)
42 42 Q_PROPERTY(QAxis *axisY READ axisY)
@@ -120,9 +120,6 public:
120 120 Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name = "");
121 121
122 122 Q_SIGNALS:
123 void themeChanged();
124 void animationOptionsChanged();
125 void titleChanged();
126 123 void axisLabelsChanged();
127 124 void titleColorChanged();
128 125 void backgroundColorChanged();
@@ -34,7 +34,6 class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, pu
34 34 {
35 35 Q_OBJECT
36 36 Q_INTERFACES(QDeclarativeParserStatus)
37 Q_PROPERTY(QColor color READ penColor WRITE setPenColor)
38 37 Q_PROPERTY(int count READ count NOTIFY countChanged)
39 38 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
40 39 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
@@ -68,18 +68,6 void DeclarativeScatterSeries::appendDeclarativeChildren(QDeclarativeListPropert
68 68 // Empty implementation, childs are parsed in componentComplete
69 69 }
70 70
71 QColor DeclarativeScatterSeries::brushColor()
72 {
73 return brush().color();
74 }
75
76 void DeclarativeScatterSeries::setBrushColor(QColor color)
77 {
78 QBrush b = brush();
79 b.setColor(color);
80 setBrush(b);
81 }
82
83 71 #include "moc_declarativescatterseries.cpp"
84 72
85 73 QTCOMMERCIALCHART_END_NAMESPACE
@@ -33,8 +33,6 class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeri
33 33 {
34 34 Q_OBJECT
35 35 Q_INTERFACES(QDeclarativeParserStatus)
36 Q_PROPERTY(QColor color READ brushColor WRITE setBrushColor)
37 Q_PROPERTY(QColor borderColor READ penColor WRITE setPenColor)
38 36 Q_PROPERTY(int count READ count NOTIFY countChanged)
39 37 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
40 38 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
@@ -43,8 +41,6 public:
43 41 explicit DeclarativeScatterSeries(QObject *parent = 0);
44 42 QXYSeries *xySeries();
45 43 QDeclarativeListProperty<QObject> declarativeChildren();
46 QColor brushColor();
47 void setBrushColor(QColor color);
48 44
49 45 public: // from QDeclarativeParserStatus
50 46 void classBegin() { DeclarativeXySeries::classBegin(); }
@@ -34,7 +34,6 class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries
34 34 {
35 35 Q_OBJECT
36 36 Q_INTERFACES(QDeclarativeParserStatus)
37 Q_PROPERTY(QColor color READ penColor WRITE setPenColor)
38 37 Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
39 38 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
40 39
@@ -59,23 +59,6 void DeclarativeXySeries::componentComplete()
59 59 }
60 60 }
61 61
62 QColor DeclarativeXySeries::penColor()
63 {
64 // All the inherited objects must be of type QXYSeries, so it is safe to cast
65 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
66 Q_ASSERT(series);
67 return series->pen().color();
68 }
69
70 void DeclarativeXySeries::setPenColor(QColor color)
71 {
72 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
73 Q_ASSERT(series);
74 QPen pen = series->pen();
75 pen.setColor(color);
76 series->setPen(pen);
77 }
78
79 62 DeclarativeXyPoint *DeclarativeXySeries::at(int index)
80 63 {
81 64 QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
@@ -41,8 +41,6 public:
41 41 void classBegin();
42 42 void componentComplete();
43 43 virtual QXYSeries *xySeries() = 0;
44 QColor penColor();
45 void setPenColor(QColor color);
46 44 DeclarativeXyPoint *at(int index);
47 45 };
48 46
@@ -58,6 +58,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE
58 58 */
59 59
60 60 /*!
61 \property QAreaSeries::color
62 Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
63 \sa QAreaSeries::brush()
64 */
65
66 /*!
67 \property QAreaSeries::borderColor
68 Line (pen) color of the series. This is a convenience property for modifying the color of pen.
69 \sa QAreaSeries::pen()
70 */
71
72 /*!
61 73 \fn QPen QAreaSeries::pen() const
62 74 \brief Returns the pen used to draw line for this series.
63 75 \sa setPen()
@@ -70,6 +82,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE
70 82 */
71 83
72 84 /*!
85 \fn void QAreaSeries::colorChanged(QColor color)
86 \brief Signal is emitted when the fill (brush) color has changed to \a color.
87 */
88
89 /*!
90 \fn void QAreaSeries::borderColorChanged(QColor color)
91 \brief Signal is emitted when the line (pen) color has changed to \a color.
92 */
93
94 /*!
73 95 \fn bool QAreaSeries::pointsVisible() const
74 96 \brief Returns if the points are drawn for this series.
75 97 \sa setPointsVisible()
@@ -191,6 +213,37 QBrush QAreaSeries::brush() const
191 213 Q_D(const QAreaSeries);
192 214 return d->m_brush;
193 215 }
216
217 void QAreaSeries::setColor(const QColor &color)
218 {
219 QBrush b = brush();
220 if (b.color() != color) {
221 b.setColor(color);
222 setBrush(b);
223 emit colorChanged(color);
224 }
225 }
226
227 QColor QAreaSeries::color() const
228 {
229 return brush().color();
230 }
231
232 void QAreaSeries::setBorderColor(const QColor &color)
233 {
234 QPen p = pen();
235 if (p.color() != color) {
236 p.setColor(color);
237 setPen(p);
238 emit borderColorChanged(color);
239 }
240 }
241
242 QColor QAreaSeries::borderColor() const
243 {
244 return pen().color();
245 }
246
194 247 /*!
195 248 Sets if data points are \a visible and should be drawn on line.
196 249 */
@@ -35,6 +35,8 class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QAbstractSeries
35 35 Q_OBJECT
36 36 Q_PROPERTY(QAbstractSeries *upperSeries READ upperSeries)
37 37 Q_PROPERTY(QAbstractSeries *lowerSeries READ lowerSeries)
38 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
39 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
38 40
39 41 public:
40 42 explicit QAreaSeries(QObject *parent = 0);
@@ -55,16 +57,24 public:
55 57 void setBrush(const QBrush &brush);
56 58 QBrush brush() const;
57 59
60 void setColor(const QColor &color);
61 QColor color() const;
62
63 void setBorderColor(const QColor &color);
64 QColor borderColor() const;
65
58 66 void setPointsVisible(bool visible = true);
59 67 bool pointsVisible() const;
60 68
61 69 Q_SIGNALS:
62 70 void clicked(const QPointF &point);
63 71 void selected();
72 void colorChanged(QColor color);
73 void borderColorChanged(QColor color);
64 74
65 75 private:
66 Q_DECLARE_PRIVATE(QAreaSeries);
67 Q_DISABLE_COPY(QAreaSeries);
76 Q_DECLARE_PRIVATE(QAreaSeries)
77 Q_DISABLE_COPY(QAreaSeries)
68 78 friend class AreaLegendMarker;
69 79 friend class AreaChartItem;
70 80 };
@@ -218,11 +218,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
218 218 */
219 219
220 220 /*!
221 \fn void QAxis::labelsAngleChanged(int)
222 Emitted if the \a angle of the axis labels is changed.
223 */
224
225 /*!
226 221 \fn void QAxis::shadesVisibleChanged(bool)
227 222 Emitted if the visibility of the axis shades is changed to \a visible.
228 223 */
@@ -238,18 +233,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
238 233 */
239 234
240 235 /*!
241 \fn void QAxis::ticksCountChanged(int count)
242 \brief Emits the new \a count of ticks on the axis
243 Signal is emitted when the number of the ticks on the axis has been changed to a different value.
244 Parementer count\a count is the new number of ticks on the axis.
245 */
246
247 /*!
248 \fn void QAxis::niceNumbersEnabledChanged(bool)
249 Nice numbers algorithm was \a enabled or disabled.
250 */
251
252 /*!
253 236 Constructs new axis object which is a child of \a parent. Ownership is taken by
254 237 QChart when axis added.
255 238 */
@@ -427,7 +410,6 void QAxis::setLabelsAngle(int angle)
427 410 if (d_ptr->m_labelsAngle != angle) {
428 411 d_ptr->m_labelsAngle = angle;
429 412 emit d_ptr->updated();
430 emit labelsAngleChanged(angle);
431 413 }
432 414 }
433 415
@@ -579,7 +561,6 void QAxis::setTicksCount(int count)
579 561 {
580 562 if (d_ptr->m_ticksCount != count) {
581 563 d_ptr->m_ticksCount = count;
582 emit ticksCountChanged(count);
583 564 emit d_ptr->changed(d_ptr->m_min, d_ptr->m_max, d_ptr->m_ticksCount, d_ptr->m_niceNumbers);
584 565 }
585 566 }
@@ -622,7 +603,6 void QAxis::setNiceNumbersEnabled(bool enable)
622 603 if (d_ptr->m_niceNumbers != enable){
623 604 d_ptr->m_niceNumbers = enable;
624 605 emit d_ptr->changed(d_ptr->m_min, d_ptr->m_max, d_ptr->m_ticksCount, d_ptr->m_niceNumbers);
625 emit niceNumbersEnabledChanged(enable);
626 606 }
627 607 }
628 608
@@ -36,7 +36,7 class QTCOMMERCIALCHART_EXPORT QAxis : public QObject
36 36 Q_PROPERTY(bool visible READ isAxisVisible WRITE setAxisVisible NOTIFY visibleChanged)
37 37 Q_PROPERTY(QColor color READ axisPenColor WRITE setAxisPenColor NOTIFY colorChanged)
38 38 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
39 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged)
39 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle)
40 40 Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged)
41 41 Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
42 42 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
@@ -44,8 +44,8 class QTCOMMERCIALCHART_EXPORT QAxis : public QObject
44 44 Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged)
45 45 Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
46 46 Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
47 Q_PROPERTY(int ticksCount READ ticksCount WRITE setTicksCount NOTIFY ticksCountChanged)
48 Q_PROPERTY(bool niceNumbersEnabled READ niceNumbersEnabled WRITE setNiceNumbersEnabled NOTIFY niceNumbersEnabledChanged)
47 Q_PROPERTY(int ticksCount READ ticksCount WRITE setTicksCount)
48 Q_PROPERTY(bool niceNumbersEnabled READ niceNumbersEnabled WRITE setNiceNumbersEnabled)
49 49
50 50 public:
51 51
@@ -118,14 +118,11 Q_SIGNALS:
118 118 void rangeChanged(qreal min, qreal max);
119 119 void colorChanged(QColor color);
120 120 void labelsColorChanged(QColor color);
121 void labelsAngleChanged(int angle);
122 121 void shadesVisibleChanged(bool visible);
123 122 void shadesColorChanged(QColor color);
124 123 void shadesBorderColorChanged(QColor color);
125 124 void minChanged(qreal min);
126 125 void maxChanged(qreal max);
127 void ticksCountChanged(int count);
128 void niceNumbersEnabledChanged(bool enabled);
129 126
130 127 private:
131 128 QScopedPointer<QAxisPrivate> d_ptr;
@@ -121,11 +121,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
121 121 */
122 122
123 123 /*!
124 \fn void QLegend::alignmentChanged(Qt::Alignment)
125 Emitted when the \a alignment of the legend changes.
126 */
127
128 /*!
129 124 \fn void QLegend::backgroundVisibleChanged(bool)
130 125 The visibility of the legend background changed to \a visible.
131 126 */
@@ -271,7 +266,6 void QLegend::setAlignment(Qt::Alignment alignment)
271 266 if(d_ptr->m_alignment!=alignment) {
272 267 d_ptr->m_alignment = alignment;
273 268 d_ptr->updateLayout();
274 alignmentChanged(alignment);
275 269 }
276 270 }
277 271
@@ -43,7 +43,7 class QLegendPrivate;
43 43 class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsWidget
44 44 {
45 45 Q_OBJECT
46 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
46 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
47 47 Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged)
48 48 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
49 49 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
@@ -86,7 +86,6 protected:
86 86 void showEvent(QShowEvent *event);
87 87
88 88 Q_SIGNALS:
89 void alignmentChanged(Qt::Alignment alignment);
90 89 void backgroundVisibleChanged(bool visible);
91 90 void colorChanged(QColor color);
92 91 void borderColorChanged(QColor color);
@@ -56,25 +56,37
56 56 */
57 57
58 58 /*!
59 \property QScatterSeries::markerShape
60
61 Defines the shape of the marker used to draw the points in the series.
59 \property QScatterSeries::color
60 Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
61 \sa QScatterSeries::brush()
62 62 */
63 63
64 64 /*!
65 \fn void QScatterSeries::markerShapeChanged()
66 Emitted when marker shape is changed
65 \property QScatterSeries::borderColor
66 Line (pen) color of the series. This is a convenience property for modifying the color of pen.
67 \sa QScatterSeries::pen()
67 68 */
68 69
69 70 /*!
70 \fn void QScatterSeries::markerSizeChanged()
71 Emitted when marker size is changed
71 \property QScatterSeries::markerShape
72
73 Defines the shape of the marker used to draw the points in the series. The default shape is MarkerShapeCircle.
72 74 */
73 75
74 76 /*!
75 77 \property QScatterSeries::markerSize
76 78
77 Defines the size of the marker used to draw the points in the series.
79 Defines the size of the marker used to draw the points in the series. The default size is 15.0.
80 */
81
82 /*!
83 \fn void QScatterSeries::colorChanged(QColor color)
84 \brief Signal is emitted when the fill (brush) color has changed to \a color.
85 */
86
87 /*!
88 \fn void QScatterSeries::borderColorChanged(QColor color)
89 \brief Signal is emitted when the line (pen) color has changed to \a color.
78 90 */
79 91
80 92 /*!
@@ -108,47 +120,64 QAbstractSeries::SeriesType QScatterSeries::type() const
108 120 return QAbstractSeries::SeriesTypeScatter;
109 121 }
110 122
111 /*!
112 Returns the shape used for drawing markers.
113 */
123 void QScatterSeries::setColor(const QColor &color)
124 {
125 QBrush b = brush();
126 if (b.color() != color) {
127 b.setColor(color);
128 setBrush(b);
129 emit colorChanged(color);
130 }
131 }
132
133 QColor QScatterSeries::color() const
134 {
135 return brush().color();
136 }
137
138 void QScatterSeries::setBorderColor(const QColor &color)
139 {
140 QPen p = pen();
141 if (p.color() != color) {
142 p.setColor(color);
143 setPen(p);
144 emit borderColorChanged(color);
145 }
146 }
147
148 QColor QScatterSeries::borderColor() const
149 {
150 return pen().color();
151 }
152
114 153 QScatterSeries::MarkerShape QScatterSeries::markerShape() const
115 154 {
116 155 Q_D(const QScatterSeries);
117 156 return d->m_shape;
118 157 }
119 158
120 /*!
121 Overrides the default shape of the marker items with a user defined \a shape. The default shape
122 is defined by chart theme setting.
123 */
124 159 void QScatterSeries::setMarkerShape(MarkerShape shape)
125 160 {
126 161 Q_D(QScatterSeries);
127 162 if (d->m_shape != shape) {
128 163 d->m_shape = shape;
129 emit markerShapeChanged();
164 emit d->updated();
130 165 }
131 166 }
132 167
133 /*!
134 Returns the size of the marker items.
135 */
136 168 qreal QScatterSeries::markerSize() const
137 169 {
138 170 Q_D(const QScatterSeries);
139 171 return d->m_size;
140 172 }
141 173
142 /*!
143 Set the \a size of the marker items. The default size is 15.
144 */
145 174 void QScatterSeries::setMarkerSize(qreal size)
146 175 {
147 176 Q_D(QScatterSeries);
148 177
149 178 if (!qFuzzyIsNull(d->m_size - size)) {
150 179 d->m_size = size;
151 emit markerSizeChanged();
180 emit d->updated();
152 181 }
153 182 }
154 183
@@ -31,8 +31,10 class QScatterSeriesPrivate;
31 31 class QTCOMMERCIALCHART_EXPORT QScatterSeries : public QXYSeries
32 32 {
33 33 Q_OBJECT
34 Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape NOTIFY markerShapeChanged)
35 Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize NOTIFY markerSizeChanged)
34 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
35 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
36 Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape)
37 Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize)
36 38 Q_ENUMS(MarkerShape)
37 39
38 40 public:
@@ -45,20 +47,23 public:
45 47 explicit QScatterSeries(QObject *parent = 0);
46 48 ~QScatterSeries();
47 49 QAbstractSeries::SeriesType type() const;
50 void setColor(const QColor &color);
51 QColor color() const;
52 void setBorderColor(const QColor &color);
53 QColor borderColor() const;
48 54 MarkerShape markerShape() const;
49 55 void setMarkerShape(MarkerShape shape);
50 56 qreal markerSize() const;
51 57 void setMarkerSize(qreal size);
52 58
53 59 Q_SIGNALS:
54 void markerShapeChanged();
55 void markerSizeChanged();
60 void colorChanged(QColor color);
61 void borderColorChanged(QColor color);
56 62
57 63 private:
58 64 Q_DECLARE_PRIVATE(QScatterSeries)
59 65 Q_DISABLE_COPY(QScatterSeries)
60 66 friend class ScatterChartItem;
61
62 67 };
63 68
64 69 QTCOMMERCIALCHART_END_NAMESPACE
@@ -39,8 +39,6 ScatterChartItem::ScatterChartItem(QScatterSeries *series, ChartPresenter *prese
39 39 m_size(15)
40 40 {
41 41 QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(handleUpdated()));
42 QObject::connect(m_series, SIGNAL(markerShapeChanged()), this, SLOT(handleUpdated()));
43 QObject::connect(m_series, SIGNAL(markerSizeChanged()), this, SLOT(handleUpdated()));
44 42 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
45 43
46 44 setZValue(ChartPresenter::ScatterSeriesZValue);
@@ -49,6 +49,12 QTCOMMERCIALCHART_BEGIN_NAMESPACE
49 49 */
50 50
51 51 /*!
52 \property QXYSeries::color
53 Line (pen) color of the series. This is a convenience property for modifying the color of pen.
54 \sa QXYSeries::pen()
55 */
56
57 /*!
52 58 \fn void QXYSeries::clicked(const QPointF& point)
53 59 \brief Signal is emitted when user clicks the \a point on chart.
54 60 */
@@ -72,8 +78,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
72 78 */
73 79
74 80 /*!
75 \fn void QXYSeries::pointsVisibleChanged(bool visible)
76 \brief Signal is emitted when the point visibility has changed to \a visible.
81 \fn void QXYSeries::colorChanged(QColor color)
82 \brief Signal is emitted when the line (pen) color has changed to \a color.
77 83 */
78 84
79 85 /*!
@@ -254,6 +260,20 QBrush QXYSeries::brush() const
254 260 return d->m_brush;
255 261 }
256 262
263 void QXYSeries::setColor(const QColor &color)
264 {
265 QPen p = pen();
266 if (p.color() != color) {
267 p.setColor(color);
268 setPen(p);
269 emit colorChanged(color);
270 }
271 }
272
273 QColor QXYSeries::color() const
274 {
275 return pen().color();
276 }
257 277
258 278 void QXYSeries::setPointsVisible(bool visible)
259 279 {
@@ -261,7 +281,6 void QXYSeries::setPointsVisible(bool visible)
261 281 if (d->m_pointsVisible != visible){
262 282 d->m_pointsVisible = visible;
263 283 emit d->updated();
264 emit pointsVisibleChanged(visible);
265 284 }
266 285 }
267 286
@@ -36,7 +36,8 class QXYModelMapper;
36 36 class QTCOMMERCIALCHART_EXPORT QXYSeries : public QAbstractSeries
37 37 {
38 38 Q_OBJECT
39 Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible NOTIFY pointsVisibleChanged)
39 Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible)
40 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
40 41
41 42 protected:
42 43 explicit QXYSeries(QXYSeriesPrivate &d,QObject *parent = 0);
@@ -65,6 +66,9 public:
65 66 void setBrush(const QBrush &brush);
66 67 QBrush brush() const;
67 68
69 virtual void setColor(const QColor &color);
70 virtual QColor color() const;
71
68 72 void setPointsVisible(bool visible = true);
69 73 bool pointsVisible() const;
70 74
@@ -73,8 +77,7 Q_SIGNALS:
73 77 void pointReplaced(int index);
74 78 void pointRemoved(int index);
75 79 void pointAdded(int index);
76 void pointsVisibleChanged(bool visible);
77
80 void colorChanged(QColor color);
78 81
79 82 private:
80 83 Q_DECLARE_PRIVATE(QXYSeries)
@@ -29,12 +29,16 Flow {
29 29 property variant series
30 30
31 31 onSeriesChanged: {
32 seriesConnections.target = series;
32 if (series && series.name == "area 1") {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
33 37 }
34 38
35 39 Connections {
36 40 id: seriesConnections
37 ignoreUnknownSignals: true
41 target: null
38 42 onNameChanged: console.log("series.onNameChanged: " + series.name);
39 43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
40 44 onColorChanged: console.log("series.onColorChanged: " + series.color);
@@ -32,6 +32,7 ChartView {
32 32
33 33 BarSeries {
34 34 id: daSeries
35 name: "bar"
35 36 BarSet { label: "Bob"; values: [4, 7, 3, 10, 5, 6] }
36 37 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 8] }
37 38 BarSet { label: "James"; values: [3, 5, 8, 5, 4, 7] }
@@ -28,13 +28,18 Flow {
28 28 property variant series
29 29
30 30 onSeriesChanged: {
31 seriesConnections.target = series;
32 setConnections.target = series.at(0);
31 if (series && series.name == "bar") {
32 seriesConnections.target = series;
33 setConnections.target = series.at(0);
34 } else {
35 seriesConnections.target = null;
36 setConnections.target = null;
37 }
33 38 }
34 39
35 40 Connections {
36 41 id: seriesConnections
37 ignoreUnknownSignals: true
42 target: null
38 43 onNameChanged: console.log("series.onNameChanged: " + series.name);
39 44 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
40 45 onBarWidthChanged: console.log("series.onBardWidthChanged: " + width)
@@ -44,7 +49,7 Flow {
44 49
45 50 Connections {
46 51 id: setConnections
47 ignoreUnknownSignals: true
52 target: null
48 53 onColorChanged: console.log("series.onColorChanged: " + color);
49 54 onBorderColorChanged: console.log("series.onBorderColorChanged: " + color);
50 55 onLabelColorChanged: console.log("series.onLabelColorChanged: " + color);
@@ -29,18 +29,22 Flow {
29 29 property variant series // TODO: rename to chart
30 30
31 31 onSeriesChanged: {
32 legendConnections.target = series.legend;
33 axisXConnections.target = series.axisX;
34 axisYConnections.target = series.axisY;
32 if (series && series.name == "") {
33 chartConnections.target = series;
34 legendConnections.target = series.legend;
35 axisXConnections.target = series.axisX;
36 axisYConnections.target = series.axisY;
37 } else {
38 legendConnections.target = null;
39 axisXConnections.target = null;
40 axisYConnections.target = null;
41 }
35 42 }
36 43
37 44 Connections {
38 target: series
39 ignoreUnknownSignals: true
45 id: chartConnections
46 target: null
40 47 onVisibleChanged: console.log("chart.onVisibleChanged: " + series.visible);
41 onThemeChanged: console.log("chart.onThemeChanged: " + series.theme);
42 onLegendChanged: console.log("chart.onLegendChanged: " + series.legend);
43 onAnimationOptionsChanged: console.log("chart.onAnimationOptionsChanged: " + series.animationOptions);
44 48 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + series.titleColor);
45 49 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + series.backgroundColor);
46 50 onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled);
@@ -48,8 +52,7 Flow {
48 52
49 53 Connections {
50 54 id: legendConnections
51 ignoreUnknownSignals: true
52 onAlignmentChanged: console.log("legend.onAlignmentChanged: " + alignment);
55 target: null
53 56 onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
54 57 onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible);
55 58 onColorChanged: console.log("legend.onColorChanged: " + color);
@@ -58,11 +61,10 Flow {
58 61
59 62 Connections {
60 63 id: axisXConnections
61 ignoreUnknownSignals: true
64 target: null
62 65 onColorChanged: console.log("axisX.onColorChanged: " + color);
63 66 onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
64 67 onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
65 onLabelsAngleChanged: console.log("axisX.onLabelsAngleChanged: " + angle);
66 68 onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
67 69 onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
68 70 onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
@@ -70,17 +72,14 Flow {
70 72 onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
71 73 onMinChanged: console.log("axisX.onMinChanged: " + min);
72 74 onMaxChanged: console.log("axisX.onMaxChanged: " + max);
73 onTicksCountChanged: console.log("axisX.onTicksCountChanged: " + count);
74 onNiceNumbersEnabledChanged: console.log("axisX.onNiceNumbersEnabledChanged: " + enabled);
75 75 }
76 76
77 77 Connections {
78 78 id: axisYConnections
79 ignoreUnknownSignals: true
79 target: null
80 80 onColorChanged: console.log("axisY.onColorChanged: " + color);
81 81 onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
82 82 onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
83 onLabelsAngleChanged: console.log("axisY.onLabelsAngleChanged: " + angle);
84 83 onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
85 84 onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
86 85 onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
@@ -88,8 +87,6 Flow {
88 87 onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
89 88 onMinChanged: console.log("axisY.onMinChanged: " + min);
90 89 onMaxChanged: console.log("axisY.onMaxChanged: " + max);
91 onTicksCountChanged: console.log("axisY.onTicksCountChanged: " + count);
92 onNiceNumbersEnabledChanged: console.log("axisY.onNiceNumbersEnabledChanged: " + enabled);
93 90 }
94 91
95 92 Button {
@@ -32,6 +32,7 ChartView {
32 32
33 33 GroupedBarSeries {
34 34 id: daSeries
35 name: "bar"
35 36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
36 37 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
37 38 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
@@ -29,15 +29,18 Flow {
29 29 property variant series
30 30
31 31 onSeriesChanged: {
32 seriesConnections.target = series;
32 if (series && (series.name == "line 1" || series.name == "spline 1")) {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
33 37 }
34 38
35 39 Connections {
36 40 id: seriesConnections
37 ignoreUnknownSignals: true
41 target: null
38 42 onNameChanged: console.log("series.onNameChanged: " + series.name);
39 43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
40 onPointsVisibleChanged: console.log("series.onPointsVisibleChanged: " + series.pointsVisible);
41 44 onColorChanged: console.log("series.onColorChanged: " + series.color);
42 45 onCountChanged: console.log("series.onCountChanged: " + series.count);
43 46 }
@@ -32,6 +32,7 ChartView {
32 32
33 33 PercentBarSeries {
34 34 id: daSeries
35 name: "bar"
35 36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
36 37 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
37 38 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
@@ -30,6 +30,7 ChartView {
30 30
31 31 PieSeries {
32 32 id: pieSeries
33 name: "pie"
33 34 PieSlice { id: daSlice; label: "slice1"; value: 11 }
34 35 PieSlice { label: "slice2"; value: 22 }
35 36 PieSlice { label: "slice3"; value: 33 }
@@ -28,13 +28,18 Flow {
28 28 property variant series
29 29
30 30 onSeriesChanged: {
31 seriesConnections.target = series;
32 sliceConnections.target = series.at(0);
31 if (series && series.name == "pie") {
32 seriesConnections.target = series;
33 sliceConnections.target = series.at(0);
34 } else {
35 seriesConnections.target = null;
36 sliceConnections.target = null;
37 }
33 38 }
34 39
35 40 Connections {
36 41 id: seriesConnections
37 ignoreUnknownSignals: true
42 target: null
38 43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
39 44 onHorizontalPositionChanged:console.log("series.onHorizontalPositionChanged: " + series.horizontalPosition);
40 45 onVerticalPositionChanged: console.log("series.onVerticalPositionChanged: " + series.verticalPosition);
@@ -47,7 +52,7 Flow {
47 52
48 53 Connections {
49 54 id: sliceConnections
50 ignoreUnknownSignals: true
55 target: null
51 56 onValueChanged: console.log("slice.onValueChanged: " + series.at(0).value);
52 57 onLabelVisibleChanged: console.log("slice.onLabelVisibleChanged: " + series.at(0).labelVisible);
53 58 onLabelPositionChanged: console.log("slice.onLabelPositionChanged: " + series.at(0).labelPosition);
@@ -29,20 +29,21 Flow {
29 29 property variant series
30 30
31 31 onSeriesChanged: {
32 seriesConnections.target = series;
32 if (series && series.name == "scatter 1") {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
33 37 }
34 38
35 39 Connections {
36 40 id: seriesConnections
37 ignoreUnknownSignals: true
41 target: null
38 42 onNameChanged: console.log("series.onNameChanged: " + series.name);
39 43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
40 onPointsVisibleChanged: console.log("series.onPointsVisibleChanged: " + series.pointsVisible);
41 44 onColorChanged: console.log("series.onColorChanged: " + series.color);
42 45 onBorderColorChanged: console.log("series.onBorderColorChanged: " + series.borderColor);
43 46 onCountChanged: console.log("series.onCountChanged: " + series.count);
44 onMarkerSizeChanged: console.log("series.onMarkerSizeChanged: " + series.markerSize);
45 onMarkerShapeChanged: console.log("series.onMarkerShapeChanged: " + series.markerShape);
46 47 }
47 48
48 49 Button {
@@ -32,6 +32,7 ChartView {
32 32
33 33 StackedBarSeries {
34 34 id: daSeries
35 name: "bar"
35 36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
36 37 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
37 38 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
General Comments 0
You need to be logged in to leave comments. Login now