plotmagnifier.h
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5  */
6 
7 #ifndef PLOTMAGNIFIER_H
8 #define PLOTMAGNIFIER_H
9 
10 #include <QTimer>
11 #include "qwt_plot_magnifier.h"
12 #include "qwt_plot.h"
13 #include <QEvent>
14 
16 {
17  Q_OBJECT
18 
19 public:
20  explicit PlotMagnifier(QWidget* canvas);
21  virtual ~PlotMagnifier() override;
22 
23  void setAxisLimits(int axis, double lower, double upper);
24  virtual void widgetWheelEvent(QWheelEvent* event) override;
25 
26  enum AxisMode
27  {
31  };
32 
33  virtual void rescale(double factor) override
34  {
35  rescale(factor, _default_mode);
36  }
37 
39  {
40  _default_mode = mode;
41  }
42 
43  void rescale(double factor, AxisMode axis);
44 
45 protected:
46  virtual void widgetMousePressEvent(QMouseEvent* event) override;
47 
50 
51  QPointF _mouse_position;
52 
53 signals:
54  void rescaled(QRectF new_size);
55 
56 private:
57  QPointF invTransform(QPoint pos);
58  QTimer _future_emit;
60 };
61 
62 #endif // PLOTMAGNIFIER_H
QTimer _future_emit
Definition: plotmagnifier.h:58
virtual void rescale(double factor) override
Definition: plotmagnifier.h:33
QwtPlotMagnifier provides zooming, by magnifying in steps.
QPointF invTransform(QPoint pos)
virtual void widgetMousePressEvent(QMouseEvent *event) override
double _upper_bounds[QwtPlot::axisCnt]
Definition: plotmagnifier.h:49
double _lower_bounds[QwtPlot::axisCnt]
Definition: plotmagnifier.h:48
QPointF _mouse_position
Definition: plotmagnifier.h:51
virtual void widgetWheelEvent(QWheelEvent *event) override
virtual ~PlotMagnifier() override
void setDefaultMode(AxisMode mode)
Definition: plotmagnifier.h:38
void rescaled(QRectF new_size)
QWidget * canvas()
Return observed plot canvas.
AxisMode _default_mode
Definition: plotmagnifier.h:59
void setAxisLimits(int axis, double lower, double upper)
PlotMagnifier(QWidget *canvas)


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:01:38