25 if ( max - min < minRange )
27 min = 0.5 * ( min + max - minRange );
35 double minBounded = transform->
bounded( min );
36 double maxBounded = transform->
bounded( max );
38 if ( minBounded != min )
40 maxBounded = transform->
bounded( minBounded + minRange );
42 else if ( maxBounded != max )
44 minBounded = transform->
bounded( maxBounded - minRange );
60 if ( minSize.width() > r.width() )
63 r.left(), r.right(), minSize.width(), transformX );
69 if ( minSize.height() > r.height() )
72 zoomRect.top(), zoomRect.bottom(), minSize.height(), transformY );
134 QWidget*
canvas,
bool doReplot )
152 if ( doReplot &&
plot() ){
269 const QRectF bRect = base | sRect;
319 const QRectF
zoomRect = rect.normalized();
333 Q_EMIT
zoomed( zoomRect );
387 if ( zoomStack.isEmpty() )
396 if ( zoomRectIndex < 0 || zoomRectIndex > zoomStack.count() )
397 zoomRectIndex = zoomStack.count() - 1;
429 double x1 = rect.left();
430 double x2 = rect.right();
436 double y1 = rect.top();
437 double y2 = rect.bottom();
524 moveTo( QPointF( rect.left() + dx, rect.top() + dy ) );
570 if ( pa.count() < 2 )
573 QRect rect = QRect( pa.first(), pa.last() );
574 rect = rect.normalized();
576 const int minSize = 2;
577 if ( rect.width() < minSize && rect.height() < minSize )
582 const QPoint
center = rect.center();
583 rect.setSize( rect.size().expandedTo( QSize( minZoomSize, minZoomSize ) ) );
584 rect.moveCenter( center );
587 pa[0] = rect.topLeft();
588 pa[1] = rect.bottomRight();
619 if ( minSize.isValid() )
624 if ( minSize.width() >= sz.width() &&
625 minSize.height() >= sz.height() )
655 if ( pa.count() < 2 )
658 QRect rect = QRect( pa.first(), pa.last() );
659 rect = rect.normalized();
675 #include "moc_qwt_plot_zoomer.cpp"
double invTransform(double p) const
virtual void widgetKeyPressEvent(QKeyEvent *)
QwtPlotZoomer(QWidget *, bool doReplot=true)
Create a zoomer for a plot canvas.
void setZoomStack(const QStack< QRectF > &, int zoomRectIndex=-1)
Assign a zoom stack.
virtual void zoom(const QRectF &)
Zoom in.
virtual void widgetKeyPressEvent(QKeyEvent *) QWT_OVERRIDE
void setRubberBand(RubberBand)
QwtAxisId xAxis() const
Return x axis.
virtual void widgetMouseReleaseEvent(QMouseEvent *) QWT_OVERRIDE
virtual void begin() QWT_OVERRIDE
uint zoomRectIndex() const
A class representing an interval.
QwtAxisId yAxis() const
Return y axis.
void setTrackerMode(DisplayMode)
Set the display mode of the tracker.
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
virtual void replot()
Redraw the plot.
const QwtScaleDiv & axisScaleDiv(QwtAxisId) const
Return the scale division of a specified axis.
virtual bool end(bool ok=true) QWT_OVERRIDE
A state machine for rectangle selections.
const QwtTransform * transformation() const
Get the transformation.
bool isIncreasing() const
Check if the scale division is increasing( lowerBound() <= upperBound() )
virtual QSizeF minZoomSize() const
Limit zooming by a minimum rectangle.
bool mouseMatch(MousePatternCode, const QMouseEvent *) const
Compare a mouse event with an event pattern.
virtual void setAxes(QwtAxisId xAxisId, QwtAxisId yAxisId)
void setStateMachine(QwtPickerMachine *)
QwtPlotPicker provides selections on a plot canvas.
int maxStackDepth() const
virtual void setAxes(QwtAxisId xAxis, QwtAxisId yAxis) QWT_OVERRIDE
void setMaxStackDepth(int)
Limit the number of recursive zoom operations to depth.
int QwtAxisId
Axis identifier.
void moveBy(double dx, double dy)
static QRectF qwtExpandedZoomRect(const QRectF &zoomRect, const QSizeF &minSize, const QwtTransform *transformX, const QwtTransform *transformY)
virtual void setZoomBase(bool doReplot=true)
A rectangle ( only for QwtPickerMachine::RectSelection )
QPolygon selection() const
bool keyMatch(KeyPatternCode, const QKeyEvent *) const
Compare a key event with an event pattern.
static QwtInterval qwtExpandedZoomInterval(double v1, double v2, double minRange, const QwtTransform *transform)
virtual void widgetMouseReleaseEvent(QMouseEvent *)
void setAxisScale(QwtAxisId, double min, double max, double stepSize=0)
Disable autoscaling and specify a fixed scale for a selected axis.
void init(bool doReplot)
Init the zoomer, used by the constructors.
virtual bool end(bool ok=true) QWT_OVERRIDE
QStack< QRectF > zoomStack
virtual bool accept(QPolygon &) const QWT_OVERRIDE
Check and correct a selected rectangle.
virtual QwtScaleMap canvasMap(QwtAxisId) const
const QStack< QRectF > & zoomStack() const
void zoomed(const QRectF &rect)
virtual void moveTo(const QPointF &)
Display only when the selection is active.