00001 #ifndef PLOTMAGNIFIER_H 00002 #define PLOTMAGNIFIER_H 00003 00004 #include <QTimer> 00005 #include <qwt_plot_magnifier.h> 00006 #include <qwt_plot.h> 00007 00008 class PlotMagnifier : public QwtPlotMagnifier 00009 { 00010 Q_OBJECT 00011 00012 00013 public: 00014 explicit PlotMagnifier( QWidget *canvas); 00015 virtual ~PlotMagnifier(); 00016 00017 void setAxisLimits(int axis,double lower, double upper); 00018 00019 protected: 00020 virtual void rescale( double factor ) override; 00021 00022 virtual void widgetWheelEvent( QWheelEvent *event ) override; 00023 virtual void widgetMousePressEvent( QMouseEvent* event ) override; 00024 00025 double _lower_bounds[QwtPlot::axisCnt]; 00026 double _upper_bounds[QwtPlot::axisCnt]; 00027 00028 QPointF _mouse_position; 00029 00030 signals: 00031 void rescaled(QRectF new_size); 00032 00033 private: 00034 QPointF invTransform(QPoint pos); 00035 QTimer _future_emit; 00036 00037 }; 00038 00039 #endif // PLOTMAGNIFIER_H