From b8b6e4b5b8398f6d2f3a064232fd120150575cf7 Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Tue, 25 Feb 2020 16:31:37 +0100 Subject: [PATCH] [apps/regression/graph_controller] Update model before setting cursor view --- apps/regression/graph_controller.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 4be142546..cec30642f 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -313,6 +313,8 @@ bool GraphController::moveCursorVertically(int direction) { assert(!validDot || !validRegression); + /* The model should be up to date before setting the cursor view. */ + if (validRegression) { // Select the regression *m_selectedSeriesIndex = closestRegressionSeries; @@ -324,9 +326,9 @@ bool GraphController::moveCursorVertically(int direction) { if (validDot) { // Select the dot - setRoundCrossCursorView(false); *m_selectedSeriesIndex = closestDotSeries; *m_selectedDotIndex = dotSelected; + setRoundCrossCursorView(false); if (dotSelected == m_store->numberOfPairsOfSeries(*m_selectedSeriesIndex)) { // Select the mean dot double x = m_store->meanOfColumn(*m_selectedSeriesIndex, 0); @@ -395,6 +397,8 @@ InteractiveCurveViewRangeDelegate::Range GraphController::computeYRange(Interact } void GraphController::setRoundCrossCursorView(bool round) { + /* At this point, the model (selected series and dot indices) should be up + * to date. */ if (round) { // Set the color although the cursor view stays round m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]);