@@ -118,7 +118,7 void ChartPresenter::handleSeriesAdded(QSeries* series) | |||||
118 | } |
|
118 | } | |
119 | m_chartTheme->decorate(item,lineSeries,m_chartItems.count()); |
|
119 | m_chartTheme->decorate(item,lineSeries,m_chartItems.count()); | |
120 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); |
|
120 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); | |
121 |
QObject::connect(lineSeries,SIGNAL( |
|
121 | QObject::connect(lineSeries,SIGNAL(pointChanged(int)),item,SLOT(handleModelChanged(int))); | |
122 | m_chartItems.insert(series,item); |
|
122 | m_chartItems.insert(series,item); | |
123 | break; |
|
123 | break; | |
124 | } |
|
124 | } |
@@ -43,7 +43,17 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
43 |
|
43 | |||
44 |
|
44 | |||
45 | /*! |
|
45 | /*! | |
46 |
\fn void QLineSeries:: |
|
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 | \brief \internal \a index |
|
57 | \brief \internal \a index | |
48 | */ |
|
58 | */ | |
49 |
|
59 | |||
@@ -71,6 +81,7 void QLineSeries::add(qreal x,qreal y) | |||||
71 | Q_ASSERT(m_x.size() == m_y.size()); |
|
81 | Q_ASSERT(m_x.size() == m_y.size()); | |
72 | m_x<<x; |
|
82 | m_x<<x; | |
73 | m_y<<y; |
|
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 | void QLineSeries::add(const QPointF& point) |
|
91 | void QLineSeries::add(const QPointF& point) | |
81 | { |
|
92 | { | |
82 | m_x<<point.x(); |
|
93 | add(point.x(),point.y()); | |
83 | m_y<<point.y(); |
|
|||
84 | } |
|
94 | } | |
85 |
|
95 | |||
86 | /*! |
|
96 | /*! | |
@@ -91,7 +101,7 void QLineSeries::replace(qreal x,qreal y) | |||||
91 | int index = m_x.indexOf(x); |
|
101 | int index = m_x.indexOf(x); | |
92 | m_x[index]=x; |
|
102 | m_x[index]=x; | |
93 | m_y[index]=y; |
|
103 | m_y[index]=y; | |
94 |
emit |
|
104 | emit pointChanged(index); | |
95 | } |
|
105 | } | |
96 |
|
106 | |||
97 | /*! |
|
107 | /*! | |
@@ -100,10 +110,7 void QLineSeries::replace(qreal x,qreal y) | |||||
100 | */ |
|
110 | */ | |
101 | void QLineSeries::replace(const QPointF& point) |
|
111 | void QLineSeries::replace(const QPointF& point) | |
102 | { |
|
112 | { | |
103 | int index = m_x.indexOf(point.x()); |
|
113 | replace(point.x(),point.y()); | |
104 | m_x[index]=point.x(); |
|
|||
105 | m_y[index]=point.y(); |
|
|||
106 | emit changed(index); |
|
|||
107 | } |
|
114 | } | |
108 |
|
115 | |||
109 | /*! |
|
116 | /*! | |
@@ -111,7 +118,10 void QLineSeries::replace(const QPointF& point) | |||||
111 | */ |
|
118 | */ | |
112 | void QLineSeries::remove(qreal x) |
|
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 | void QLineSeries::remove(const QPointF& point) |
|
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 | QLineSeries& operator << (const QPointF &point); |
|
39 | QLineSeries& operator << (const QPointF &point); | |
40 | friend QDebug operator<< (QDebug d, const QLineSeries series); |
|
40 | friend QDebug operator<< (QDebug d, const QLineSeries series); | |
41 |
|
41 | |||
42 |
|
||||
43 | signals: |
|
42 | signals: | |
44 |
void |
|
43 | void pointChanged(int index); | |
|
44 | void pointRemoved(int index); | |||
|
45 | void pointAdded(int index); | |||
45 |
|
46 | |||
46 | private: |
|
47 | private: | |
47 | QVector<qreal> m_x; |
|
48 | QVector<qreal> m_x; |
General Comments 0
You need to be logged in to leave comments.
Login now