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
PlotMagnifier::_future_emit
QTimer _future_emit
Definition: plotmagnifier.h:58
PlotMagnifier::setAxisLimits
void setAxisLimits(int axis, double lower, double upper)
Definition: plotmagnifier.cpp:30
QwtPlotMagnifier::canvas
QWidget * canvas()
Return observed plot canvas.
Definition: qwt_plot_magnifier.cpp:76
PlotMagnifier::PlotMagnifier
PlotMagnifier(QWidget *canvas)
Definition: plotmagnifier.cpp:16
PlotMagnifier::AxisMode
AxisMode
Definition: plotmagnifier.h:26
PlotMagnifier::_upper_bounds
double _upper_bounds[QwtPlot::axisCnt]
Definition: plotmagnifier.h:49
PlotMagnifier::_default_mode
AxisMode _default_mode
Definition: plotmagnifier.h:59
PlotMagnifier::Y_AXIS
@ Y_AXIS
Definition: plotmagnifier.h:29
qwt_plot_magnifier.h
PlotMagnifier::rescale
virtual void rescale(double factor) override
Definition: plotmagnifier.h:33
PlotMagnifier::X_AXIS
@ X_AXIS
Definition: plotmagnifier.h:28
PlotMagnifier::widgetMousePressEvent
virtual void widgetMousePressEvent(QMouseEvent *event) override
Definition: plotmagnifier.cpp:158
QwtPlot::axisCnt
@ axisCnt
Definition: qwt_plot.h:245
PlotMagnifier
Definition: plotmagnifier.h:15
PlotMagnifier::rescaled
void rescaled(QRectF new_size)
PlotMagnifier::setDefaultMode
void setDefaultMode(AxisMode mode)
Definition: plotmagnifier.h:38
PlotMagnifier::invTransform
QPointF invTransform(QPoint pos)
Definition: plotmagnifier.cpp:145
PlotMagnifier::_mouse_position
QPointF _mouse_position
Definition: plotmagnifier.h:51
PlotMagnifier::_lower_bounds
double _lower_bounds[QwtPlot::axisCnt]
Definition: plotmagnifier.h:48
PlotMagnifier::widgetWheelEvent
virtual void widgetWheelEvent(QWheelEvent *event) override
Definition: plotmagnifier.cpp:152
PlotMagnifier::BOTH_AXES
@ BOTH_AXES
Definition: plotmagnifier.h:30
PlotMagnifier::~PlotMagnifier
virtual ~PlotMagnifier() override
Definition: plotmagnifier.cpp:26
qwt_plot.h
QwtPlotMagnifier
QwtPlotMagnifier provides zooming, by magnifying in steps.
Definition: qwt_plot_magnifier.h:30


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:23