From 343e611fa4446ccd31347594432121c600ed2b44 Mon Sep 17 00:00:00 2001 From: Jan Grewe Date: Wed, 19 Sep 2018 15:05:11 +0200 Subject: [PATCH] [chart] emit newDataRequest on scroll --- chart.cpp | 12 +----------- chart.h | 4 ++++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/chart.cpp b/chart.cpp index 0369edd..091cf6a 100644 --- a/chart.cpp +++ b/chart.cpp @@ -59,18 +59,8 @@ void Chart::XRangeChanged(qreal min, qreal max) { std::cerr << "XRangeChanged" << min << "\t"<< max << std::endl; if (series().at(0)->type() == QtCharts::QAbstractSeries::SeriesTypeLine) { QLineSeries *s = static_cast(series().at(0)); - qreal xmax = s->at(s->count()-1).x(); if (max > s->at(s->count()-1).x()) { - QList buffer; - - std::cerr << "new DATA!!!" << std::endl; - double si = s->at(1).x() - s->at(0).x(); - qreal currentx = xmax; - buffer.reserve(1000); - for (int i = 0; i < 1000; ++i) { - buffer.push_back({xmax + i * si, 0.0}); - } - s->append(buffer); + emit newDataRequest(this->entityId, max); } } } diff --git a/chart.h b/chart.h index ae11559..193152c 100644 --- a/chart.h +++ b/chart.h @@ -17,6 +17,7 @@ public: ~Chart(); bool sceneEvent(QEvent *event); + std::string entityId; private: bool gestureEvent(QGestureEvent *event); @@ -24,5 +25,8 @@ private: public slots: void XRangeChanged(qreal min, qreal max); + +signals: + void newDataRequest(const std::string &entityId, qreal max); }; #endif // CHART_H