##// END OF EJS Templates
Adds replace,remove,add signals to qchartline
Michal Klocek -
r374:d3fe1a118d91
parent child
Show More
@@ -118,7 +118,7 void ChartPresenter::handleSeriesAdded(QSeries* series)
118 118 }
119 119 m_chartTheme->decorate(item,lineSeries,m_chartItems.count());
120 120 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&)));
121 QObject::connect(lineSeries,SIGNAL(changed(int)),item,SLOT(handleModelChanged(int)));
121 QObject::connect(lineSeries,SIGNAL(pointChanged(int)),item,SLOT(handleModelChanged(int)));
122 122 m_chartItems.insert(series,item);
123 123 break;
124 124 }
@@ -43,7 +43,17 QTCOMMERCIALCHART_BEGIN_NAMESPACE
43 43
44 44
45 45 /*!
46 \fn void QLineSeries::changed(int index)
46 \fn void QLineSeries::pointChanged(int index)
47 \brief \internal \a index
48 */
49
50 /*!
51 \fn void QLineSeries::pointAdded(int index)
52 \brief \internal \a index
53 */
54
55 /*!
56 \fn void QLineSeries::pointRemoved(int index)
47 57 \brief \internal \a index
48 58 */
49 59
@@ -71,6 +81,7 void QLineSeries::add(qreal x,qreal y)
71 81 Q_ASSERT(m_x.size() == m_y.size());
72 82 m_x<<x;
73 83 m_y<<y;
84 emit pointAdded(m_x.size()-1);
74 85 }
75 86
76 87 /*!
@@ -79,8 +90,7 void QLineSeries::add(qreal x,qreal y)
79 90 */
80 91 void QLineSeries::add(const QPointF& point)
81 92 {
82 m_x<<point.x();
83 m_y<<point.y();
93 add(point.x(),point.y());
84 94 }
85 95
86 96 /*!
@@ -91,7 +101,7 void QLineSeries::replace(qreal x,qreal y)
91 101 int index = m_x.indexOf(x);
92 102 m_x[index]=x;
93 103 m_y[index]=y;
94 emit changed(index);
104 emit pointChanged(index);
95 105 }
96 106
97 107 /*!
@@ -100,10 +110,7 void QLineSeries::replace(qreal x,qreal y)
100 110 */
101 111 void QLineSeries::replace(const QPointF& point)
102 112 {
103 int index = m_x.indexOf(point.x());
104 m_x[index]=point.x();
105 m_y[index]=point.y();
106 emit changed(index);
113 replace(point.x(),point.y());
107 114 }
108 115
109 116 /*!
@@ -111,7 +118,10 void QLineSeries::replace(const QPointF& point)
111 118 */
112 119 void QLineSeries::remove(qreal x)
113 120 {
114
121 int index = m_x.indexOf(x);
122 m_x.remove(index);
123 m_y.remove(index);
124 emit pointRemoved(index);
115 125 }
116 126
117 127 /*!
@@ -119,7 +129,7 void QLineSeries::remove(qreal x)
119 129 */
120 130 void QLineSeries::remove(const QPointF& point)
121 131 {
122
132 remove(point.x());
123 133 }
124 134
125 135 /*!
@@ -39,9 +39,10 public: // from QChartSeries
39 39 QLineSeries& operator << (const QPointF &point);
40 40 friend QDebug operator<< (QDebug d, const QLineSeries series);
41 41
42
43 42 signals:
44 void changed(int index);
43 void pointChanged(int index);
44 void pointRemoved(int index);
45 void pointAdded(int index);
45 46
46 47 private:
47 48 QVector<qreal> m_x;
General Comments 0
You need to be logged in to leave comments. Login now