From c19e8112150991076e03d09b785fd7479cc3950e Mon Sep 17 00:00:00 2001 From: Thomas Renne <thomas.renne@u-psud.fr> Date: Tue, 8 Dec 2020 11:37:23 +0100 Subject: [PATCH] Add axis range handler to move multiple plots at once --- src/pappsomspp/widget/xicwidget/xicwidget.cpp | 27 +++++++++++++++++++ src/pappsomspp/widget/xicwidget/xicwidget.h | 9 +++++++ 2 files changed, 36 insertions(+) diff --git a/src/pappsomspp/widget/xicwidget/xicwidget.cpp b/src/pappsomspp/widget/xicwidget/xicwidget.cpp index 858bba371..8207b5a94 100644 --- a/src/pappsomspp/widget/xicwidget/xicwidget.cpp +++ b/src/pappsomspp/widget/xicwidget/xicwidget.cpp @@ -55,6 +55,7 @@ XicWidget::XicWidget(QWidget *parent) : GraphicDeviceWidget(parent) XicWidget::~XicWidget() { } + void XicWidget::addMsMsEvent(const Xic *xic_p, pappso::pappso_double rt) { @@ -98,6 +99,32 @@ XicWidget::rescale() _qcp_xic->rescale(); } +QCPAxis * +XicWidget::getRtAxisP() +{ + return _qcp_xic->xAxis; +} + +QCPAxis * +XicWidget::getIntensityAxisP() +{ + return _qcp_xic->yAxis; +} + +void +XicWidget::rescaleOneRange(QString axis_name, QCPRange new_range) +{ + if(axis_name == "xAxis") + { + _qcp_xic->xAxis->setRange(new_range); + } + else // axis_name == "yAxis" + { + _qcp_xic->yAxis->setRange(new_range); + } + _qcp_xic->replot(); +} + void XicWidget::clear() { diff --git a/src/pappsomspp/widget/xicwidget/xicwidget.h b/src/pappsomspp/widget/xicwidget/xicwidget.h index b59d6e80a..5038cc15a 100644 --- a/src/pappsomspp/widget/xicwidget/xicwidget.h +++ b/src/pappsomspp/widget/xicwidget/xicwidget.h @@ -35,6 +35,7 @@ #include "../../xic/xic.h" #include "../../processing/detection/tracepeak.h" #include "../graphicdevicewidget.h" +#include <qcustomplot.h> namespace pappso @@ -66,6 +67,11 @@ class PMSPP_LIB_DECL XicWidget : public GraphicDeviceWidget void setRetentionTimeInMinutes(); void drawXicPeakBorders(pappso::TracePeakCstSPtr xic_peak); void clearXicPeakBorders(); + /** @brief get the plots axis and rescale one axis with the given range + */ + QCPAxis *getRtAxisP(); + QCPAxis *getIntensityAxisP(); + void rescaleOneRange(QString axis_name, QCPRange new_range); signals: /** @brief announce the current retention time (under mouse) in seconds @@ -75,6 +81,9 @@ class PMSPP_LIB_DECL XicWidget : public GraphicDeviceWidget /** @brief announce mouse position on click (rt in seconds, intensity) */ void clicked(double rt, double intensity) const; + /** @brief get the new Range when its change + */ + void operateNewRange(QCPRange new_range); protected: friend class QCPXic; -- GitLab