##// END OF EJS Templates
rename functions add() -> append()
Jani Honkonen -
r796:4bbe1f66d4b7
parent child
Show More
@@ -184,8 +184,8 QChart* ThemeWidget::createAreaChart() const
184 184 QLineSeries *series1 = new QLineSeries(chart);
185 185 QLineSeries *series2 = new QLineSeries(chart);
186 186 foreach (Data data, m_dataTable[i]) {
187 series1->add(data.first);
188 series2->add(QPointF(data.first.x(), 0.0));
187 series1->append(data.first);
188 series2->append(QPointF(data.first.x(), 0.0));
189 189 }
190 190 QAreaSeries *area = new QAreaSeries(series1, series2);
191 191 area->setName(name + QString::number(nameIndex));
@@ -230,7 +230,7 QChart* ThemeWidget::createLineChart() const
230 230 foreach (DataList list, m_dataTable) {
231 231 QLineSeries *series = new QLineSeries(chart);
232 232 foreach (Data data, list)
233 series->add(data.first);
233 series->append(data.first);
234 234 series->setName(name + QString::number(nameIndex));
235 235 nameIndex++;
236 236 chart->addSeries(series);
@@ -247,7 +247,7 QChart* ThemeWidget::createPieChart() const
247 247 for (int i = 0; i < m_dataTable.count(); i++) {
248 248 QPieSeries *series = new QPieSeries(chart);
249 249 foreach (Data data, m_dataTable[i]) {
250 QPieSlice *slice = series->add(data.first.y(), data.second);
250 QPieSlice *slice = series->append(data.first.y(), data.second);
251 251 if (data == m_dataTable[i].first()) {
252 252 slice->setLabelVisible();
253 253 slice->setExploded();
@@ -271,7 +271,7 QChart* ThemeWidget::createSplineChart() const
271 271 foreach (DataList list, m_dataTable) {
272 272 QSplineSeries *series = new QSplineSeries(chart);
273 273 foreach (Data data, list)
274 series->add(data.first);
274 series->append(data.first);
275 275 series->setName(name + QString::number(nameIndex));
276 276 nameIndex++;
277 277 chart->addSeries(series);
@@ -288,7 +288,7 QChart* ThemeWidget::createScatterChart() const
288 288 foreach (DataList list, m_dataTable) {
289 289 QScatterSeries *series = new QScatterSeries(chart);
290 290 foreach (Data data, list)
291 series->add(data.first);
291 series->append(data.first);
292 292 series->setName(name + QString::number(nameIndex));
293 293 nameIndex++;
294 294 chart->addSeries(series);
@@ -22,9 +22,9 int main(int argc, char *argv[])
22 22 chartView->setChartTitle("Simple Line Chart");
23 23 // Add series to the chart
24 24 QLineSeries *line = new QLineSeries();
25 line->add(0.0, 0.8);
26 line->add(1.1, 1.1);
27 line->add(2.0, 2.5);
25 line->append(0.0, 0.8);
26 line->append(1.1, 1.1);
27 line->append(2.0, 2.5);
28 28 chartView->addSeries(line);
29 29 //! [1]
30 30
@@ -39,8 +39,8 int main(int argc, char *argv[])
39 39 // Add pie series
40 40 // ...
41 41 QPieSeries *pie = new QPieSeries();
42 pie->add(3.4, "slice1");
43 pie->add(6.7, "slice2");
42 pie->append(3.4, "slice1");
43 pie->append(6.7, "slice2");
44 44 chartView->addSeries(pie);
45 45 //! [3]
46 46
@@ -27,8 +27,8 public:
27 27 int fluctuate = 100;
28 28
29 29 for (qreal x = 0; x <= 2*PI; x+=m_step) {
30 series1->add(x, fabs(sin(x)*fluctuate));
31 series2->add(x, fabs(cos(x)*fluctuate));
30 series1->append(x, fabs(sin(x)*fluctuate));
31 series2->append(x, fabs(cos(x)*fluctuate));
32 32 }
33 33
34 34 QObject::connect(&m_timer,SIGNAL(timeout()),this,SLOT(update()));
@@ -25,8 +25,8 m_y(1)
25 25 green.setWidth(3);
26 26 m_series1->setPen(green);
27 27
28 m_series0->add(m_x,m_y);
29 m_series1->add(m_x,m_y);
28 m_series0->append(m_x,m_y);
29 m_series1->append(m_x,m_y);
30 30
31 31 setChartTitle("Simple EKG chart");
32 32 addSeries(m_series0);
@@ -46,8 +46,8 void ChartView::handleTimeout()
46 46 {
47 47 m_x+=m_step;
48 48 m_y = qrand() % 5 - 2.5;
49 m_series0->add(m_x,m_y);
50 m_series1->add(m_x,m_y);
49 m_series0->append(m_x,m_y);
50 m_series1->append(m_x,m_y);
51 51 if(m_x>=10)
52 52 {
53 53 m_series0->remove(m_x-10);
@@ -60,11 +60,11 int main(int argc, char *argv[])
60 60 //![1]
61 61
62 62 //![2]
63 series0->add(0, 6);
64 series0->add(2, 4);
65 series0->add(3, 8);
66 series0->add(7, 4);
67 series0->add(10, 5);
63 series0->append(0, 6);
64 series0->append(2, 4);
65 series0->append(3, 8);
66 series0->append(7, 4);
67 series0->append(10, 5);
68 68
69 69 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
70 70 //![2]
@@ -16,8 +16,8 MultiChartWidget::MultiChartWidget(QWidget *parent) :
16 16 QChartView *chartView1 = new QChartView();
17 17 l->addWidget(chartView1);
18 18 QPieSeries *pie = new QPieSeries();
19 pie->add(1.1, "label1");
20 pie->add(1.2, "label2");
19 pie->append(1.1, "label1");
20 pie->append(1.2, "label2");
21 21 chartView1->addSeries(pie);
22 22
23 23 // Create chart 2 and add a simple scatter series onto it
@@ -51,11 +51,11 int main(int argc, char *argv[])
51 51
52 52 //![1]
53 53 QPieSeries *series = new QPieSeries();
54 series->add(1, "Slice 1");
55 series->add(2, "Slice 2");
56 series->add(3, "Slice 3");
57 series->add(4, "Slice 4");
58 series->add(5, "Slice 5");
54 series->append(1, "Slice 1");
55 series->append(2, "Slice 2");
56 series->append(3, "Slice 3");
57 series->append(4, "Slice 4");
58 series->append(5, "Slice 5");
59 59 //![1]
60 60
61 61 //![2]
@@ -41,9 +41,9 m_index(0)
41 41
42 42 for (int x = 0; x <= numPoints; ++x) {
43 43 qreal y = qrand() % 100;
44 series0->add(x,y);
45 series1->add(x,y);
46 series2->add(x,y);
44 series0->append(x,y);
45 series1->append(x,y);
46 series2->append(x,y);
47 47 }
48 48 //![2]
49 49
@@ -67,11 +67,11 int main(int argc, char *argv[])
67 67 //![1]
68 68
69 69 //![2]
70 series0->add(0, 6);
71 series0->add(2, 4);
72 series0->add(3, 8);
73 series0->add(7, 4);
74 series0->add(10, 5);
70 series0->append(0, 6);
71 series0->append(2, 4);
72 series0->append(3, 8);
73 series0->append(7, 4);
74 series0->append(10, 5);
75 75
76 76 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
77 77 //![2]
@@ -28,31 +28,31 SplineWidget::SplineWidget(QWidget *parent)
28 28
29 29 //! [add points to series]
30 30 //add data points to the series
31 series->add(QPointF(150, 100));
32 series->add(QPointF(200, 130));
33 series->add(QPointF(250, 120));
34 series->add(QPointF(300, 140));
35 series->add(QPointF(350, 160));
31 series->append(QPointF(150, 100));
32 series->append(QPointF(200, 130));
33 series->append(QPointF(250, 120));
34 series->append(QPointF(300, 140));
35 series->append(QPointF(350, 160));
36 36 //! [add points to series]
37 37
38 38 QSplineSeries* series2 = new QSplineSeries;
39 39
40 series2->add(QPointF(400, 120));
41 series2->add(QPointF(450, 150));
42 series2->add(QPointF(500, 145));
43 series2->add(QPointF(550, 170));
40 series2->append(QPointF(400, 120));
41 series2->append(QPointF(450, 150));
42 series2->append(QPointF(500, 145));
43 series2->append(QPointF(550, 170));
44 44
45 // series->add(QPointF(600, 190));
46 // series->add(QPointF(650, 210));
47 // series->add(QPointF(700, 190));
48 // series->add(QPointF(750, 180));
49 // series->add(QPointF(800, 170));
45 // series->append(QPointF(600, 190));
46 // series->append(QPointF(650, 210));
47 // series->append(QPointF(700, 190));
48 // series->append(QPointF(750, 180));
49 // series->append(QPointF(800, 170));
50 50 QSplineSeries* series3 = new QSplineSeries;
51 series3->add(QPointF(600, 190));
52 series3->add(QPointF(650, 210));
53 series3->add(QPointF(700, 190));
54 series3->add(QPointF(750, 180));
55 series3->add(QPointF(800, 170));
51 series3->append(QPointF(600, 190));
52 series3->append(QPointF(650, 210));
53 series3->append(QPointF(700, 190));
54 series3->append(QPointF(750, 180));
55 series3->append(QPointF(800, 170));
56 56
57 57 //! [3]
58 58 // create chart view
@@ -96,9 +96,9 SplineWidget::SplineWidget(QWidget *parent)
96 96 void SplineWidget::addNewPoint()
97 97 {
98 98 if (series->count() > 0)
99 series->add(QPointF(series->x(series->count() - 1) + 40 + qrand()%40, qAbs(series->y(series->count() - 1) - 50 + qrand()%100)));
99 series->append(QPointF(series->x(series->count() - 1) + 40 + qrand()%40, qAbs(series->y(series->count() - 1) - 50 + qrand()%100)));
100 100 else
101 series->add(QPointF(50, 50 + qrand()%50));
101 series->append(QPointF(50, 50 + qrand()%50));
102 102 }
103 103 //! [add point]
104 104
@@ -35,7 +35,7 void DeclarativePieSeries::appendSlice(QDeclarativeListProperty<QPieSlice> *list
35 35 {
36 36 DeclarativePieSeries *series = qobject_cast<DeclarativePieSeries *>(list->object);
37 37 if (series)
38 series->add(slice->value(), slice->label());
38 series->append(slice->value(), slice->label());
39 39 }
40 40
41 41 #include "moc_declarativepieseries.cpp"
@@ -21,7 +21,7 void DeclarativeXySeries::appendPoints(QDeclarativeListProperty<DeclarativeXyPoi
21 21 {
22 22 QXYSeries *series = qobject_cast<QXYSeries *>(list->object);
23 23 if (series)
24 series->add(QPointF(element->x(), element->y()));
24 series->append(QPointF(element->x(), element->y()));
25 25 }
26 26
27 27 QTCOMMERCIALCHART_END_NAMESPACE
@@ -40,8 +40,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
40 40 Creating basic area chart is simple:
41 41 \code
42 42 QLineSeries* lineSeries = new QLineSeries();
43 series->add(0, 6);
44 series->add(2, 4);
43 series->append(0, 6);
44 series->append(2, 4);
45 45 QAreaSeries* areaSeries = new QAreaSeries(lineSeries);
46 46 ...
47 47 chartView->addSeries(areaSeries);
@@ -36,8 +36,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 36 Creating basic line chart is simple:
37 37 \code
38 38 QLineSeries* series = new QLineSeries();
39 series->add(0, 6);
40 series->add(2, 4);
39 series->append(0, 6);
40 series->append(2, 4);
41 41 ...
42 42 chartView->addSeries(series);
43 43 \endcode
@@ -228,14 +228,14 QSeries::QSeriesType QPieSeries::type() const
228 228 void QPieSeries::replace(QList<QPieSlice*> slices)
229 229 {
230 230 clear();
231 add(slices);
231 append(slices);
232 232 }
233 233
234 234 /*!
235 235 Adds an array of \a slices to the series.
236 236 Slice ownership is passed to the series.
237 237 */
238 void QPieSeries::add(QList<QPieSlice*> slices)
238 void QPieSeries::append(QList<QPieSlice*> slices)
239 239 {
240 240 Q_D(QPieSeries);
241 241
@@ -260,9 +260,9 void QPieSeries::add(QList<QPieSlice*> slices)
260 260 Adds a single \a slice to the series.
261 261 Slice ownership is passed to the series.
262 262 */
263 void QPieSeries::add(QPieSlice* slice)
263 void QPieSeries::append(QPieSlice* slice)
264 264 {
265 add(QList<QPieSlice*>() << slice);
265 append(QList<QPieSlice*>() << slice);
266 266 }
267 267
268 268 /*!
@@ -271,7 +271,7 void QPieSeries::add(QPieSlice* slice)
271 271 */
272 272 QPieSeries& QPieSeries::operator << (QPieSlice* slice)
273 273 {
274 add(slice);
274 append(slice);
275 275 return *this;
276 276 }
277 277
@@ -280,10 +280,10 QPieSeries& QPieSeries::operator << (QPieSlice* slice)
280 280 Adds a single slice to the series with give \a value and \a name.
281 281 Slice ownership is passed to the series.
282 282 */
283 QPieSlice* QPieSeries::add(qreal value, QString name)
283 QPieSlice* QPieSeries::append(qreal value, QString name)
284 284 {
285 285 QPieSlice* slice = new QPieSlice(value, name);
286 add(slice);
286 append(slice);
287 287 return slice;
288 288 }
289 289
@@ -644,10 +644,10 void QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::O
644 644 // create the initial slices set
645 645 if (d->m_mapOrientation == Qt::Vertical) {
646 646 for (int i = 0; i < m_model->rowCount(); i++)
647 add(m_model->data(m_model->index(i, d->m_mapValues), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(i, d->m_mapLabels), Qt::DisplayRole).toString());
647 append(m_model->data(m_model->index(i, d->m_mapValues), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(i, d->m_mapLabels), Qt::DisplayRole).toString());
648 648 } else {
649 649 for (int i = 0; i < m_model->columnCount(); i++)
650 add(m_model->data(m_model->index(d->m_mapValues, i), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(d->m_mapLabels, i), Qt::DisplayRole).toString());
650 append(m_model->data(m_model->index(d->m_mapValues, i), Qt::DisplayRole).toDouble(), m_model->data(m_model->index(d->m_mapLabels, i), Qt::DisplayRole).toString());
651 651 }
652 652 }
653 653
@@ -41,8 +41,8 public: // from QChartSeries
41 41 public:
42 42
43 43 // slice setters
44 void add(QPieSlice* slice);
45 void add(QList<QPieSlice*> slices);
44 void append(QPieSlice* slice);
45 void append(QList<QPieSlice*> slices);
46 46 void insert(int i, QPieSlice* slice);
47 47 void replace(QList<QPieSlice*> slices);
48 48 void remove(QPieSlice* slice);
@@ -69,7 +69,7 public:
69 69
70 70 // convenience function
71 71 QPieSeries& operator << (QPieSlice* slice);
72 QPieSlice* add(qreal value, QString name);
72 QPieSlice* append(qreal value, QString name);
73 73 void setLabelsVisible(bool visible = true);
74 74
75 75 // data from model
@@ -53,7 +53,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
53 53
54 54 Note that QPieSeries takes ownership of the slice when it is set/added.
55 55
56 \sa QPieSeries::replace(), QPieSeries::add()
56 \sa QPieSeries::replace(), QPieSeries::append()
57 57 */
58 58 QPieSlice::QPieSlice(QObject *parent)
59 59 :QObject(parent),
@@ -65,7 +65,7 QPieSlice::QPieSlice(QObject *parent)
65 65 /*!
66 66 Constructs an empty slice with given \a value, \a label and a \a parent.
67 67 Note that QPieSeries takes ownership of the slice when it is set/added.
68 \sa QPieSeries::replace(), QPieSeries::add()
68 \sa QPieSeries::replace(), QPieSeries::append()
69 69 */
70 70 QPieSlice::QPieSlice(qreal value, QString label, QObject *parent)
71 71 :QObject(parent),
@@ -35,8 +35,8
35 35 Creating basic scatter chart is simple:
36 36 \code
37 37 QScatterSeries* series = new QScatterSeries();
38 series->add(0, 6);
39 series->add(2, 4);
38 series->append(0, 6);
39 series->append(2, 4);
40 40 ...
41 41 chartView->addSeries(series);
42 42 \endcode
@@ -89,7 +89,7 QXYSeries::~QXYSeries()
89 89 /*!
90 90 Adds data point \a x \a y to the series. Points are connected with lines on the chart.
91 91 */
92 void QXYSeries::add(qreal x,qreal y)
92 void QXYSeries::append(qreal x,qreal y)
93 93 {
94 94 Q_ASSERT(m_x.size() == m_y.size());
95 95 m_x<<x;
@@ -101,19 +101,19 void QXYSeries::add(qreal x,qreal y)
101 101 This is an overloaded function.
102 102 Adds data \a point to the series. Points are connected with lines on the chart.
103 103 */
104 void QXYSeries::add(const QPointF &point)
104 void QXYSeries::append(const QPointF &point)
105 105 {
106 add(point.x(),point.y());
106 append(point.x(),point.y());
107 107 }
108 108
109 109 /*!
110 110 This is an overloaded function.
111 111 Adds list of data \a points to the series. Points are connected with lines on the chart.
112 112 */
113 void QXYSeries::add(const QList<QPointF> points)
113 void QXYSeries::append(const QList<QPointF> points)
114 114 {
115 115 foreach(const QPointF& point , points) {
116 add(point.x(),point.y());
116 append(point.x(),point.y());
117 117 }
118 118 }
119 119
@@ -293,24 +293,24 void QXYSeries::setBrush(const QBrush &brush)
293 293
294 294 /*!
295 295 Stream operator for adding a data \a point to the series.
296 \sa add()
296 \sa append()
297 297 */
298 298
299 299 QXYSeries& QXYSeries::operator<< (const QPointF &point)
300 300 {
301 add(point);
301 append(point);
302 302 return *this;
303 303 }
304 304
305 305
306 306 /*!
307 307 Stream operator for adding a list of \a points to the series.
308 \sa add()
308 \sa append()
309 309 */
310 310
311 311 QXYSeries& QXYSeries::operator<< (const QList<QPointF> points)
312 312 {
313 add(points);
313 append(points);
314 314 return *this;
315 315 }
316 316
@@ -36,9 +36,9 protected:
36 36 virtual ~QXYSeries();
37 37
38 38 public:
39 void add(qreal x, qreal y);
40 void add(const QPointF &point);
41 void add(const QList<QPointF> points);
39 void append(qreal x, qreal y);
40 void append(const QPointF &point);
41 void append(const QList<QPointF> points);
42 42 void replace(qreal x,qreal y);
43 43 void replace(const QPointF &point);
44 44 void remove(qreal x);
General Comments 0
You need to be logged in to leave comments. Login now