From 672ea1cb191f9d386ce32b96102fe638fcae5fba 2016-02-10 11:47:24 From: Miikka Heikkinen Date: 2016-02-10 11:47:24 Subject: [PATCH] Explicitly update GLWidget when we set new points QOpenGLWidget was modified to not trigger some extra paint calls, which charts used to rely on, so now we do explicit updates instead. Change-Id: Ibe06c2f88ac7efe4e61351d582f2eff9d350f073 Task-number: QTBUG-51000 Reviewed-by: Tomi Korpipää Reviewed-by: Mika Salmela Reviewed-by: Miikka Heikkinen --- diff --git a/src/charts/chartpresenter.cpp b/src/charts/chartpresenter.cpp index 1676a89..9273a13 100644 --- a/src/charts/chartpresenter.cpp +++ b/src/charts/chartpresenter.cpp @@ -549,7 +549,7 @@ QString ChartPresenter::numberToString(int value) return QString::number(value); } -void ChartPresenter::ensureGLWidget() +void ChartPresenter::updateGLWidget() { #ifndef QT_NO_OPENGL // GLWidget pointer is wrapped in QPointer as its parent is not in our control, and therefore @@ -566,6 +566,9 @@ void ChartPresenter::ensureGLWidget() m_glWidget->show(); } } + // Make sure we update the widget in a timely manner + if (!m_glWidget.isNull()) + m_glWidget->update(); #endif } diff --git a/src/charts/chartpresenter_p.h b/src/charts/chartpresenter_p.h index 2faca11..35df286 100644 --- a/src/charts/chartpresenter_p.h +++ b/src/charts/chartpresenter_p.h @@ -166,7 +166,7 @@ public: QString numberToString(double value, char f = 'g', int prec = 6); QString numberToString(int value); - void ensureGLWidget(); + void updateGLWidget(); void glSetUseWidget(bool enable) { m_glUseWidget = enable; } private: diff --git a/src/charts/xychart/xychart.cpp b/src/charts/xychart/xychart.cpp index cfe0753..718bc35 100644 --- a/src/charts/xychart/xychart.cpp +++ b/src/charts/xychart/xychart.cpp @@ -113,8 +113,8 @@ void XYChart::updateChart(QVector &oldPoints, QVector &newPoin void XYChart::updateGlChart() { - presenter()->ensureGLWidget(); dataSet()->glXYSeriesDataManager()->setPoints(m_series, domain()); + presenter()->updateGLWidget(); updateGeometry(); }