From d6a8295d9690d1cac04512af87e1bf1641624654 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 13 Mar 2024 17:55:04 +0100 Subject: [PATCH] ScientificPlot rm timer; instead use QCP's queued replot --- GUI/View/Plotter/ColorMap.cpp | 1 - GUI/View/Plotter/ScientificPlot.cpp | 19 +------------------ GUI/View/Plotter/ScientificPlot.h | 3 --- GUI/View/Plotter/SpecularPlot.cpp | 1 - 4 files changed, 1 insertion(+), 23 deletions(-) diff --git a/GUI/View/Plotter/ColorMap.cpp b/GUI/View/Plotter/ColorMap.cpp index 975791b7b1e..1d7ab1d74d4 100644 --- a/GUI/View/Plotter/ColorMap.cpp +++ b/GUI/View/Plotter/ColorMap.cpp @@ -129,7 +129,6 @@ void ColorMap::itemToMap(Data2DItem* item) setAxesRangeConnected(true); setDataRangeConnected(true); - setUpdateTimerConnected(true); } QString ColorMap::infoString(const QPointF& pos) const diff --git a/GUI/View/Plotter/ScientificPlot.cpp b/GUI/View/Plotter/ScientificPlot.cpp index e3f6d21cb72..10b920da09b 100644 --- a/GUI/View/Plotter/ScientificPlot.cpp +++ b/GUI/View/Plotter/ScientificPlot.cpp @@ -13,14 +13,12 @@ // ************************************************************************************************ #include "GUI/View/Plotter/ScientificPlot.h" -#include "GUI/Support/Thread/UpdateTimer.h" #include "GUI/View/Plotter/PlotEventHelper.h" #include <QEvent> #include <qcustomplot.h> ScientificPlot::ScientificPlot(PLOT_TYPE plot_type) : m_qcp(new QCustomPlot) - , m_update_timer(new UpdateTimer(10, this)) , m_plot_type(plot_type) , m_event_helper(new PlotEventHelper(this)) { @@ -75,22 +73,7 @@ qreal ScientificPlot::fromSceneY(qreal p) const return m_qcp->yAxis->pixelToCoord(p); } -void ScientificPlot::setUpdateTimerConnected(bool isConnected) -{ - if (isConnected) - connect(m_update_timer, &UpdateTimer::timeToUpdate, this, &ScientificPlot::onTimeToReplot, - Qt::UniqueConnection); - else - disconnect(m_update_timer, &UpdateTimer::timeToUpdate, this, - &ScientificPlot::onTimeToReplot); -} - void ScientificPlot::replot() { - m_update_timer->scheduleUpdate(); -} - -void ScientificPlot::onTimeToReplot() -{ - m_qcp->replot(); + m_qcp->replot(QCustomPlot::rpQueuedReplot); } diff --git a/GUI/View/Plotter/ScientificPlot.h b/GUI/View/Plotter/ScientificPlot.h index 49414373fa1..fa8b79b03f4 100644 --- a/GUI/View/Plotter/ScientificPlot.h +++ b/GUI/View/Plotter/ScientificPlot.h @@ -19,7 +19,6 @@ class PlotEventHelper; class QCustomPlot; -class UpdateTimer; //! Common interface for plot-descriptor interaction @@ -59,7 +58,6 @@ signals: void statusString(const QString& text); protected: - void setUpdateTimerConnected(bool isConnected); void replot(); QCustomPlot* m_qcp; @@ -69,7 +67,6 @@ private: void onTimeToReplot(); - UpdateTimer* m_update_timer; PLOT_TYPE m_plot_type; PlotEventHelper* m_event_helper; }; diff --git a/GUI/View/Plotter/SpecularPlot.cpp b/GUI/View/Plotter/SpecularPlot.cpp index 0cf7a02d2fb..03203d813d8 100644 --- a/GUI/View/Plotter/SpecularPlot.cpp +++ b/GUI/View/Plotter/SpecularPlot.cpp @@ -180,7 +180,6 @@ void SpecularPlot::initPlot() void SpecularPlot::setConnected(bool isConnected) { setAxesRangeConnected(isConnected); - setUpdateTimerConnected(isConnected); } void SpecularPlot::setAxesRangeConnected(bool isConnected) -- GitLab