diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index 9ec63ef1d7..63c95fc29d 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -821,10 +821,12 @@ void JKQTBasePlotter::setXY(double xminn, double xmaxx, double yminn, double yma yAxis->setRange(yminn, ymaxx); if (affectsSecondaryAxes) { - for (auto ax: getXAxes(false)) { + const auto xaxes=getXAxes(false); + for (auto ax: xaxes) { ax->setRange(ax->p2x(xminpix), ax->p2x(xmaxpix)); } - for (auto ax: getYAxes(false)) { + const auto yaxes=getYAxes(false); + for (auto ax: yaxes) { ax->setRange(ax->p2x(yminpix), ax->p2x(ymaxpix)); } } diff --git a/lib/jkqtplotter/jkqtpbaseplotter.h b/lib/jkqtplotter/jkqtpbaseplotter.h index c23e07d72a..679b660116 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.h +++ b/lib/jkqtplotter/jkqtpbaseplotter.h @@ -1771,7 +1771,15 @@ public Q_SLOTS: /**@}*/ Q_SIGNALS: - /** \brief signal: emitted whenever the user selects a new x-y zoom range (by mouse) */ + /** \brief signal: emitted whenever the user selects a new x-y zoom range (in the major axes, e.g. setX(), setY(), setXY(), zoomToFit()... ) + * + * \param newxmin start of the selected x-range (in plot coordinates) + * \param newxmax end of the selected x-range (in plot coordinates) + * \param newymin start of the selected x-range (in plot coordinates) + * \param newymax end of the selected x-range (in plot coordinates) + * \param sender JKQTPlotter sending this event + * + */ void zoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTBasePlotter* sender); /** \brief emitted when the plot has to be updated */ diff --git a/lib/jkqtplotter/jkqtplotter.h b/lib/jkqtplotter/jkqtplotter.h index a23eddf0e5..829cca1e5f 100644 --- a/lib/jkqtplotter/jkqtplotter.h +++ b/lib/jkqtplotter/jkqtplotter.h @@ -1248,7 +1248,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget { void contextMenuOpened(double x, double y, QMenu* contextMenu); - /** \brief signal: emitted whenever the user selects a new x-y zoom range (by mouse) + /** \brief signal: emitted whenever the user selects a new x-y zoom range (in the major axes, e.g. by mouse, setX(), setY(), setXY(), zoomToFit()... ) * * \param newxmin start of the selected x-range (in plot coordinates) * \param newxmax end of the selected x-range (in plot coordinates) @@ -1257,6 +1257,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget { * \param sender JKQTPlotter sending this event * * This signal is designed to be connected to these Q_SLOTS: synchronizeXAxis(), synchronizeYAxis(), synchronizeXYAxis() + * + * \see JKQTBasePlotter::zoomChangedLocally() */ void zoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender);