plotzoomer.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 PLOTZOOMER_H
8 #define PLOTZOOMER_H
9 
10 #include <QObject>
11 #include <QPoint>
12 #include <QDebug>
13 #include "qwt_plot_zoomer.h"
14 
15 class PlotZoomer : public QwtPlotZoomer
16 {
17 public:
18  PlotZoomer();
19 
20  explicit PlotZoomer(QWidget*);
21 
22  virtual ~PlotZoomer() override = default;
23 
24  void keepAspectRatio(bool doKeep)
25  {
26  _keep_aspect_ratio = doKeep;
27  }
28 
29 protected:
30  virtual void widgetMousePressEvent(QMouseEvent* event) override;
31  virtual void widgetMouseReleaseEvent(QMouseEvent* event) override;
32  virtual void widgetMouseMoveEvent(QMouseEvent* event) override;
33  virtual bool accept(QPolygon&) const override;
34 
35  virtual void zoom(const QRectF& rect) override;
36 
37  virtual QSizeF minZoomSize() const override;
38 
39 private:
43  QPoint _initial_pos;
44 };
45 
46 #endif // PLOTZOOMER_H
virtual QSizeF minZoomSize() const override
Limit zooming by a minimum rectangle.
Definition: plotzoomer.cpp:138
virtual ~PlotZoomer() override=default
bool _mouse_pressed
Definition: plotzoomer.h:40
void keepAspectRatio(bool doKeep)
Definition: plotzoomer.h:24
QPoint _initial_pos
Definition: plotzoomer.h:43
bool _zoom_enabled
Definition: plotzoomer.h:41
virtual bool accept(QPolygon &) const override
Check and correct a selected rectangle.
Definition: plotzoomer.cpp:92
virtual void widgetMouseMoveEvent(QMouseEvent *event) override
Definition: plotzoomer.cpp:44
QwtPlotZoomer provides stacked zooming for a plot widget.
virtual void zoom(const QRectF &rect) override
Zoom in.
Definition: plotzoomer.cpp:110
virtual void widgetMouseReleaseEvent(QMouseEvent *event) override
Definition: plotzoomer.cpp:84
virtual void widgetMousePressEvent(QMouseEvent *event) override
Definition: plotzoomer.cpp:27
bool _keep_aspect_ratio
Definition: plotzoomer.h:42


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