4 #include <QApplication> 10 _default_mode(BOTH_AXES)
32 factor = qAbs( 1.0/factor );
35 if ( plt ==
nullptr || factor == 1.0 ){
39 bool doReplot =
false;
47 for (
int i = 0;
i <2;
i++ )
49 double temp_factor = factor;
59 int axisId = axis_list[
i];
65 double v1 = scaleMap.
s1();
66 double v2 = scaleMap.
s2();
69 if( axisId == QwtPlot::yLeft){
80 const double width = ( v2 - v1 );
81 const double ratio = (v2-center)/ (width);
83 v1 = center - width*temp_factor*(1-ratio);
84 v2 = center + width*temp_factor*(ratio);
101 new_rect.setLeft( v1 );
102 new_rect.setRight( v2 );
105 new_rect.setBottom( v1 );
106 new_rect.setTop( v2 );
virtual void widgetMousePressEvent(QMouseEvent *)
void swap(any &x, any &y) any_noexcept
virtual void rescale(double factor) override
QwtPlotMagnifier provides zooming, by magnifying in steps.
virtual void widgetWheelEvent(QWheelEvent *)
QPointF invTransform(QPoint pos)
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
virtual void widgetMousePressEvent(QMouseEvent *event) override
double _upper_bounds[QwtPlot::axisCnt]
Y axis left of the canvas.
QwtPlot * plot()
Return plot widget, containing the observed plot canvas.
double _lower_bounds[QwtPlot::axisCnt]
virtual void widgetWheelEvent(QWheelEvent *event) override
virtual ~PlotMagnifier() override
bool isAxisEnabled(int axis) const
virtual QwtScaleMap canvasMap(int axisId) const
void rescaled(QRectF new_size)
const QwtTransform * transformation() const
Get the transformation.
double invTransform(double p) const
void setAxisLimits(int axis, double lower, double upper)
PlotMagnifier(QWidget *canvas)
double transform(double s) const
void setAxisScale(int axisId, double min, double max, double step=0)
Disable autoscaling and specify a fixed scale for a selected axis.