From d2b4e07c94999efcf9968daeb01eb479f4195f09 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Fri, 11 Sep 2020 13:48:07 +0200 Subject: [PATCH] added JPQTPlotter signal, when widget was resized --- doc/dox/whatsnew.dox | 1 + lib/jkqtplotter/jkqtplotter.cpp | 5 ++++- lib/jkqtplotter/jkqtplotter.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index 6bd4d86116..fab6a399d9 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -30,6 +30,7 @@ Changes, compared to \ref page_whatsnew_V2019_11 "v2019.11" include:
  • new: all geometric objects can either be drawn as graphic element (i.e. lines are straight line, even on non-linear axes), or as mathematical curve (i.e. on non-linear axes, lines become the appropriate curve representing the linear function, connecting the given start/end-points). The only exceptions are ellipses (and the derived arcs,pies,chords), which are always drawn as mathematical curves
  • new: a new graph class JKQTPXYFunctionLineGraph draws parametric 2D curves ( \f$ [x,y] = f(t) \f$ ), see \ref JKQTPlotterEvalCurves for an example
  • new: added several new copy/set-functions to JKQTPDatastore
  • +
  • new: added JPQTPlotter signal, when widget was resized
  • \subsection page_whatsnew_TRUNK_DOWNLOAD trunk: Download diff --git a/lib/jkqtplotter/jkqtplotter.cpp b/lib/jkqtplotter/jkqtplotter.cpp index 71a4e04447..891ddd6ced 100644 --- a/lib/jkqtplotter/jkqtplotter.cpp +++ b/lib/jkqtplotter/jkqtplotter.cpp @@ -1217,7 +1217,10 @@ void JKQTPlotter::delayedResizeEvent() sizeChanged=true; } - if (sizeChanged) redrawPlot(); + if (sizeChanged) { + emit widgetResized(width(), height(), this); + redrawPlot(); + } } void JKQTPlotter::leaveEvent(QEvent * /*event*/) { diff --git a/lib/jkqtplotter/jkqtplotter.h b/lib/jkqtplotter/jkqtplotter.h index b070915004..13e1046c88 100644 --- a/lib/jkqtplotter/jkqtplotter.h +++ b/lib/jkqtplotter/jkqtplotter.h @@ -1319,6 +1319,16 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget { */ void zoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender); + /** \brief signal: emitted whenever the widget is resized + * + * \param new_width new width of the widget (in pixels) + * \param new_height new height of the widget (in pixels) + * \param sender JKQTPlotter sending this event + * + * This signal is designed to be connected to these slots: synchronizeXAxis(), synchronizeYAxis(), synchronizeXYAxis() + */ + void widgetResized(int new_width, int new_height, JKQTPlotter* sender); + /** \brief emitted when the mouse action JKQTPlotter::ScribbleEvents and a click event from the mouse occurs inside the plot, * or the mouse moved while the left button is pressed down *