From 58197d19c5aa7dfb430105860b1791d2abe7eba2 Mon Sep 17 00:00:00 2001 From: Frank Palazzolo Date: Tue, 24 Oct 2023 13:32:26 -0400 Subject: [PATCH] Add option to disable resize delay feature by setting the delay to zero. --- lib/jkqtplotter/jkqtplotter.cpp | 9 +++++++-- lib/jkqtplotter/jkqtplotter.h | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/jkqtplotter/jkqtplotter.cpp b/lib/jkqtplotter/jkqtplotter.cpp index bc4a3c4cac..a363dfbcac 100644 --- a/lib/jkqtplotter/jkqtplotter.cpp +++ b/lib/jkqtplotter/jkqtplotter.cpp @@ -1370,8 +1370,13 @@ void JKQTPlotter::resizeEvent(QResizeEvent *event) { sizeChanged=true; } if (sizeChanged) { - resizeTimer.setSingleShot(true); - resizeTimer.start(jkqtp_RESIZE_DELAY); + if (jkqtp_RESIZE_DELAY == 0) { + // Do this now + delayedResizeEvent(); + } else { + resizeTimer.setSingleShot(true); + resizeTimer.start(jkqtp_RESIZE_DELAY); + } } //updateGeometry(); diff --git a/lib/jkqtplotter/jkqtplotter.h b/lib/jkqtplotter/jkqtplotter.h index c38501ddc9..304c562b36 100644 --- a/lib/jkqtplotter/jkqtplotter.h +++ b/lib/jkqtplotter/jkqtplotter.h @@ -364,7 +364,7 @@ JKQTPLOTTER_LIB_EXPORT void initJKQTPlotterResources(); class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget { Q_OBJECT public: - /** \brief sets the global resize delay in milliseconds \a delayMS. After calling this function all plots will use the new delay. This function is thread-safe! + /** \brief sets the global resize delay in milliseconds \a delayMS. After calling this function all plots will use the new delay. Setting the the delay to 0 disables the delayed resize feature. This function is thread-safe! * * \see jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer */ static void setGlobalResizeDelay(int delayMS); @@ -1687,7 +1687,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget { */ QTimer resizeTimer; - /** \brief delay for resizing in milliseconds + /** \brief delay for resizing in milliseconds. If set to 0, resize delay is disabled and resizeTimer is unused. * * \see jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer */