##// END OF EJS Templates
Changes to qchart qabstractseries API
Michal Klocek -
r1553:aa0203a138dd
parent child
Show More
@@ -59,6 +59,6 void Chart::handleTimeout()
59 m_x += m_step;
59 m_x += m_step;
60 m_y = qrand() % 5 - 2.5;
60 m_y = qrand() % 5 - 2.5;
61 m_series->append(m_x, m_y);
61 m_series->append(m_x, m_y);
62 scrollRight();
62 scroll(10,0);
63 if(m_x==100) m_timer.stop();
63 if(m_x==100) m_timer.stop();
64 }
64 }
@@ -49,7 +49,7 bool Chart::gestureEvent(QGestureEvent* event)
49 {
49 {
50 if (QGesture *gesture = event->gesture(Qt::PanGesture)) {
50 if (QGesture *gesture = event->gesture(Qt::PanGesture)) {
51 QPanGesture *pan = static_cast<QPanGesture *>(gesture);
51 QPanGesture *pan = static_cast<QPanGesture *>(gesture);
52 QChart::scroll(pan->delta());
52 QChart::scroll(pan->delta().x(),pan->delta().y());
53 }
53 }
54
54
55 if (QGesture *gesture = event->gesture(Qt::PinchGesture)) {
55 if (QGesture *gesture = event->gesture(Qt::PinchGesture)) {
@@ -82,16 +82,16 void ChartView::keyPressEvent(QKeyEvent *event)
82 break;
82 break;
83 //![1]
83 //![1]
84 case Qt::Key_Left:
84 case Qt::Key_Left:
85 chart()->scrollLeft();
85 chart()->scroll(-10,0);
86 break;
86 break;
87 case Qt::Key_Right:
87 case Qt::Key_Right:
88 chart()->scrollRight();
88 chart()->scroll(10,0);
89 break;
89 break;
90 case Qt::Key_Up:
90 case Qt::Key_Up:
91 chart()->scrollUp();
91 chart()->scroll(0,10);
92 break;
92 break;
93 case Qt::Key_Down:
93 case Qt::Key_Down:
94 chart()->scrollDown();
94 chart()->scroll(0,-10);
95 break;
95 break;
96 default:
96 default:
97 QGraphicsView::keyPressEvent(event);
97 QGraphicsView::keyPressEvent(event);
@@ -422,22 +422,22 void DeclarativeChart::zoom(qreal factor)
422
422
423 void DeclarativeChart::scrollLeft(qreal pixels)
423 void DeclarativeChart::scrollLeft(qreal pixels)
424 {
424 {
425 m_chart->scroll(QPointF(pixels, 0));
425 m_chart->scroll(pixels, 0);
426 }
426 }
427
427
428 void DeclarativeChart::scrollRight(qreal pixels)
428 void DeclarativeChart::scrollRight(qreal pixels)
429 {
429 {
430 m_chart->scroll(QPointF(-pixels, 0));
430 m_chart->scroll(-pixels, 0);
431 }
431 }
432
432
433 void DeclarativeChart::scrollUp(qreal pixels)
433 void DeclarativeChart::scrollUp(qreal pixels)
434 {
434 {
435 m_chart->scroll(QPointF(0, pixels));
435 m_chart->scroll(0, pixels);
436 }
436 }
437
437
438 void DeclarativeChart::scrollDown(qreal pixels)
438 void DeclarativeChart::scrollDown(qreal pixels)
439 {
439 {
440 m_chart->scroll(QPointF(0, -pixels));
440 m_chart->scroll(0, -pixels);
441 }
441 }
442
442
443 QAbstractSeries *DeclarativeChart::series(int index)
443 QAbstractSeries *DeclarativeChart::series(int index)
@@ -153,6 +153,21 QChart* QAbstractSeries::chart() const
153 return d_ptr->m_chart;
153 return d_ptr->m_chart;
154 }
154 }
155
155
156 void QAbstractSeries::adjustView()
157 {
158 //TODO:
159 }
160
161 void QAbstractSeries::show()
162 {
163 setVisible(true);
164 }
165
166 void QAbstractSeries::hide()
167 {
168 setVisible(false);
169 }
170
156 ///////////////////////////////////////////////////////////////////////////////////////////////////
171 ///////////////////////////////////////////////////////////////////////////////////////////////////
157
172
158 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q):
173 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q):
@@ -354,66 +354,11 QChart::AnimationOptions QChart::animationOptions() const
354 }
354 }
355
355
356 /*!
356 /*!
357 Scrolls the visible area of the chart to the left by the distance between two x axis ticks
358 */
359 void QChart::scrollLeft(qreal dx)
360 {
361 <<<<<<< Updated upstream
362 // d_ptr->m_presenter->scroll(-d_ptr->m_presenter->geometry().width()/(axisX()->ticksCount()-1),0);
363 =======
364 //TODO:
365 Q_UNUSED(dx);
366 // d_ptr->m_presenter->scroll(-d_ptr->m_presenter->geometry().width()/(axisX()->d_ptr->ticksCount()-1),0);
367 >>>>>>> Stashed changes
368 }
369
370 /*!
371 Scrolls the visible area of the chart to the right by the distance between two x axis ticks
372 */
373 void QChart::scrollRight(qreal dx)
374 {
375 <<<<<<< Updated upstream
376 // d_ptr->m_presenter->scroll(d_ptr->m_presenter->geometry().width()/(axisX()->ticksCount()-1),0);
377 =======
378 //TODO:
379 Q_UNUSED(dx);
380 // d_ptr->m_presenter->scroll(d_ptr->m_presenter->geometry().width()/(axisX()->ticksCount()-1),0);
381 >>>>>>> Stashed changes
382 }
383
384 /*!
385 Scrolls the visible area of the chart up by the distance between two y axis ticks
386 */
387 void QChart::scrollUp(qreal dy)
388 {
389 <<<<<<< Updated upstream
390 =======
391 //TODO:
392 Q_UNUSED(dy);
393 >>>>>>> Stashed changes
394 // d_ptr->m_presenter->scroll(0,d_ptr->m_presenter->geometry().width()/(axisY()->ticksCount()-1));
395 }
396
397 /*!
398 Scrolls the visible area of the chart down by the distance between two y axis ticks
399 */
400 void QChart::scrollDown(qreal dy)
401 {
402 <<<<<<< Updated upstream
403 // d_ptr->m_presenter->scroll(0,-d_ptr->m_presenter->geometry().width()/(axisY()->ticksCount()-1));
404 =======
405 //TODO:
406 Q_UNUSED(dy);
407 // d_ptr->m_presenter->scroll(0,-d_ptr->m_presenter->geometry().width()/(axisY()->ticksCount()-1));
408 >>>>>>> Stashed changes
409 }
410
411 /*!
412 Scrolls the visible area of the chart by the distance defined in the \a delta.
357 Scrolls the visible area of the chart by the distance defined in the \a delta.
413 */
358 */
414 void QChart::scroll(const QPointF &delta)
359 void QChart::scroll(qreal dx, qreal dy)
415 {
360 {
416 d_ptr->m_presenter->scroll(-delta.x(), delta.y());
361 d_ptr->m_presenter->scroll(dx, dy);
417 }
362 }
418
363
419 void QChart::setBackgroundVisible(bool visible)
364 void QChart::setBackgroundVisible(bool visible)
@@ -107,11 +107,7 public:
107 void zoomIn(const QRectF &rect);
107 void zoomIn(const QRectF &rect);
108 void zoomOut();
108 void zoomOut();
109 void zoom(qreal factor);
109 void zoom(qreal factor);
110 void scrollLeft(qreal dx);
110 void scroll(qreal dx, qreal dy);
111 void scrollRight(qreal dx);
112 void scrollUp(qreal dy);
113 void scrollDown(qreal dy);
114 void scroll(const QPointF &delta);
115
111
116 void adjustViewToSeries(QAbstractSeries* series= 0);
112 void adjustViewToSeries(QAbstractSeries* series= 0);
117
113
@@ -76,14 +76,8 private slots:
76 void removeAllSeries();
76 void removeAllSeries();
77 void removeSeries_data();
77 void removeSeries_data();
78 void removeSeries();
78 void removeSeries();
79 void scrollDown_data();
79 void scroll_data();
80 void scrollDown();
80 void scroll();
81 void scrollLeft_data();
82 void scrollLeft();
83 void scrollRight_data();
84 void scrollRight();
85 void scrollUp_data();
86 void scrollUp();
87 void theme_data();
81 void theme_data();
88 void theme();
82 void theme();
89 void title_data();
83 void title_data();
@@ -166,10 +160,7 void tst_QChart::qchart()
166 //QCOMPARE(m_chart->titleFont(),QFont());
160 //QCOMPARE(m_chart->titleFont(),QFont());
167
161
168 m_chart->removeAllSeries();
162 m_chart->removeAllSeries();
169 m_chart->scrollDown();
163 m_chart->scroll(0,0);
170 m_chart->scrollLeft();
171 m_chart->scrollRight();
172 m_chart->scrollUp();
173
164
174 m_chart->zoomIn();
165 m_chart->zoomIn();
175 m_chart->zoomIn(QRectF());
166 m_chart->zoomIn(QRectF());
@@ -468,62 +459,20 void tst_QChart::removeSeries()
468 QCOMPARE(deleteSpy.count(), 0);
459 QCOMPARE(deleteSpy.count(), 0);
469 }
460 }
470
461
471 void tst_QChart::scrollDown_data()
462 void tst_QChart::scroll_data()
472 {
463 {
473
464
474 }
465 }
475
466
476 void tst_QChart::scrollDown()
467 void tst_QChart::scroll()
477 {
468 {
478 qFatal("implement me");
469 qFatal("implement me");
479 createTestData();
470 createTestData();
480 //TODO qreal min = m_chart->axisY()->min();
471 //TODO qreal min = m_chart->axisY()->min();
481 m_chart->scrollDown();
472 m_chart->scroll(0,0);
482 //TODO QVERIFY(m_chart->axisY()->min()<min);
473 //TODO QVERIFY(m_chart->axisY()->min()<min);
483 }
474 }
484
475
485 void tst_QChart::scrollLeft_data()
486 {
487
488 }
489
490 void tst_QChart::scrollLeft()
491 {
492 qFatal("implement me");
493 createTestData();
494 //TODO qreal min = m_chart->axisX()->min();
495 m_chart->scrollLeft();
496 //TODO QVERIFY(m_chart->axisX()->min()<min);
497 }
498
499 void tst_QChart::scrollRight_data()
500 {
501
502 }
503
504 void tst_QChart::scrollRight()
505 {
506 qFatal("implement me");
507 createTestData();
508 //TODO qreal min = m_chart->axisX()->min();
509 m_chart->scrollRight();
510 //TODO QVERIFY(m_chart->axisX()->min()>min);
511 }
512
513 void tst_QChart::scrollUp_data()
514 {
515
516 }
517
518 void tst_QChart::scrollUp()
519 {
520 qFatal("implement me");
521 createTestData();
522 //TODO qreal min = m_chart->axisY()->min();
523 m_chart->scrollUp();
524 //TODO QVERIFY(m_chart->axisY()->min()>min);
525 }
526
527 void tst_QChart::theme_data()
476 void tst_QChart::theme_data()
528 {
477 {
529 QTest::addColumn<QChart::ChartTheme>("theme");
478 QTest::addColumn<QChart::ChartTheme>("theme");
General Comments 0
You need to be logged in to leave comments. Login now