.TH "QwtPlotZoomer" 3 "Mon Dec 28 2020" "Version 6.1.6" "Qwt User's Guide" \" -*- nroff -*- .ad l .nh .SH NAME QwtPlotZoomer \- \fBQwtPlotZoomer\fP provides stacked zooming for a plot widget\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBQwtPlotPicker\fP\&. .SS "Public Slots" .in +1c .ti -1c .RI "void \fBmoveBy\fP (double dx, double dy)" .br .ti -1c .RI "virtual void \fBmoveTo\fP (const QPointF &)" .br .ti -1c .RI "virtual void \fBzoom\fP (const QRectF &)" .br .RI "Zoom in\&. " .ti -1c .RI "virtual void \fBzoom\fP (int offset)" .br .RI "Zoom in or out\&. " .in -1c .SS "Signals" .in +1c .ti -1c .RI "void \fBzoomed\fP (const QRectF &rect)" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBQwtPlotZoomer\fP (QWidget *, bool doReplot=true)" .br .RI "Create a zoomer for a plot canvas\&. " .ti -1c .RI "\fBQwtPlotZoomer\fP (int \fBxAxis\fP, int \fByAxis\fP, QWidget *, bool doReplot=true)" .br .RI "Create a zoomer for a plot canvas\&. " .ti -1c .RI "virtual void \fBsetZoomBase\fP (bool doReplot=true)" .br .ti -1c .RI "virtual void \fBsetZoomBase\fP (const QRectF &)" .br .RI "Set the initial size of the zoomer\&. " .ti -1c .RI "QRectF \fBzoomBase\fP () const" .br .ti -1c .RI "QRectF \fBzoomRect\fP () const" .br .ti -1c .RI "virtual void \fBsetAxis\fP (int \fBxAxis\fP, int \fByAxis\fP)" .br .ti -1c .RI "void \fBsetMaxStackDepth\fP (int)" .br .RI "Limit the number of recursive zoom operations to depth\&. " .ti -1c .RI "int \fBmaxStackDepth\fP () const" .br .ti -1c .RI "const QStack< QRectF > & \fBzoomStack\fP () const" .br .ti -1c .RI "void \fBsetZoomStack\fP (const QStack< QRectF > &, int \fBzoomRectIndex\fP=\-1)" .br .RI "Assign a zoom stack\&. " .ti -1c .RI "uint \fBzoomRectIndex\fP () const" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual void \fBrescale\fP ()" .br .ti -1c .RI "virtual QSizeF \fBminZoomSize\fP () const" .br .RI "Limit zooming by a minimum rectangle\&. " .ti -1c .RI "virtual void \fBwidgetMouseReleaseEvent\fP (QMouseEvent *)" .br .ti -1c .RI "virtual void \fBwidgetKeyPressEvent\fP (QKeyEvent *)" .br .ti -1c .RI "virtual void \fBbegin\fP ()" .br .ti -1c .RI "virtual bool \fBend\fP (bool ok=true)" .br .ti -1c .RI "virtual bool \fBaccept\fP (QPolygon &) const" .br .RI "Check and correct a selected rectangle\&. " .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP \fBQwtPlotZoomer\fP provides stacked zooming for a plot widget\&. \fBQwtPlotZoomer\fP selects rectangles from user inputs ( mouse or keyboard ) translates them into plot coordinates and adjusts the axes to them\&. The selection is supported by a rubber band and optionally by displaying the coordinates of the current mouse position\&. .PP Zooming can be repeated as often as possible, limited only by \fBmaxStackDepth()\fP or \fBminZoomSize()\fP\&. Each rectangle is pushed on a stack\&. .PP The default setting how to select rectangles is a \fBQwtPickerDragRectMachine\fP with the following bindings: .PP .IP "\(bu" 2 \fBQwtEventPattern::MouseSelect1\fP .br The first point of the zoom rectangle is selected by a mouse press, the second point from the position, where the mouse is released\&. .IP "\(bu" 2 \fBQwtEventPattern::KeySelect1\fP .br The first key press selects the first, the second key press selects the second point\&. .IP "\(bu" 2 \fBQwtEventPattern::KeyAbort\fP .br Discard the selection in the state, where the first point is selected\&. .PP .PP To traverse the zoom stack the following bindings are used: .PP .IP "\(bu" 2 \fBQwtEventPattern::MouseSelect3\fP, \fBQwtEventPattern::KeyUndo\fP .br Zoom out one position on the zoom stack .IP "\(bu" 2 \fBQwtEventPattern::MouseSelect6\fP, \fBQwtEventPattern::KeyRedo\fP .br Zoom in one position on the zoom stack .IP "\(bu" 2 \fBQwtEventPattern::MouseSelect2\fP, \fBQwtEventPattern::KeyHome\fP .br Zoom to the zoom base .PP .PP The \fBsetKeyPattern()\fP and \fBsetMousePattern()\fP functions can be used to configure the zoomer actions\&. The following example shows, how to configure the 'I' and 'O' keys for zooming in and out one position on the zoom stack\&. The 'Home' key is used to 'unzoom' the plot\&. .PP .PP .nf zoomer = new QwtPlotZoomer( plot ); zoomer->setKeyPattern( QwtEventPattern::KeyRedo, Qt::Key_I, Qt::ShiftModifier ); zoomer->setKeyPattern( QwtEventPattern::KeyUndo, Qt::Key_O, Qt::ShiftModifier ); zoomer->setKeyPattern( QwtEventPattern::KeyHome, Qt::Key_Home ); .fi .PP .PP \fBQwtPlotZoomer\fP is tailored for plots with one x and y axis, but it is allowed to attach a second \fBQwtPlotZoomer\fP ( without rubber band and tracker ) for the other axes\&. .PP \fBNote\fP .RS 4 The realtime example includes an derived zoomer class that adds scrollbars to the plot canvas\&. .RE .PP \fBSee also\fP .RS 4 \fBQwtPlotPanner\fP, \fBQwtPlotMagnifier\fP .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "QwtPlotZoomer::QwtPlotZoomer (QWidget * canvas, bool doReplot = \fCtrue\fP)\fC [explicit]\fP" .PP Create a zoomer for a plot canvas\&. The zoomer is set to those x- and y-axis of the parent plot of the canvas that are enabled\&. If both or no x-axis are enabled, the picker is set to \fBQwtPlot::xBottom\fP\&. If both or no y-axis are enabled, it is set to \fBQwtPlot::yLeft\fP\&. .PP The zoomer is initialized with a \fBQwtPickerDragRectMachine\fP, the tracker mode is set to \fBQwtPicker::ActiveOnly\fP and the rubber band is set to \fBQwtPicker::RectRubberBand\fP .PP \fBParameters\fP .RS 4 \fIcanvas\fP Plot canvas to observe, also the parent object .br \fIdoReplot\fP Call \fBQwtPlot::replot()\fP for the attached plot before initializing the zoomer with its scales\&. This might be necessary, when the plot is in a state with pending scale changes\&. .RE .PP \fBSee also\fP .RS 4 \fBQwtPlot::autoReplot()\fP, \fBQwtPlot::replot()\fP, \fBsetZoomBase()\fP .RE .PP .SS "QwtPlotZoomer::QwtPlotZoomer (int xAxis, int yAxis, QWidget * canvas, bool doReplot = \fCtrue\fP)\fC [explicit]\fP" .PP Create a zoomer for a plot canvas\&. The zoomer is initialized with a \fBQwtPickerDragRectMachine\fP, the tracker mode is set to \fBQwtPicker::ActiveOnly\fP and the rubber band is set to \fBQwtPicker\fP;;RectRubberBand .PP \fBParameters\fP .RS 4 \fIxAxis\fP X axis of the zoomer .br \fIyAxis\fP Y axis of the zoomer .br \fIcanvas\fP Plot canvas to observe, also the parent object .br \fIdoReplot\fP Call \fBQwtPlot::replot()\fP for the attached plot before initializing the zoomer with its scales\&. This might be necessary, when the plot is in a state with pending scale changes\&. .RE .PP \fBSee also\fP .RS 4 \fBQwtPlot::autoReplot()\fP, \fBQwtPlot::replot()\fP, \fBsetZoomBase()\fP .RE .PP .SH "Member Function Documentation" .PP .SS "bool QwtPlotZoomer::accept (QPolygon & pa) const\fC [protected]\fP, \fC [virtual]\fP" .PP Check and correct a selected rectangle\&. Reject rectangles with a height or width < 2, otherwise expand the selected rectangle to a minimum size of 11x11 and accept it\&. .PP \fBReturns\fP .RS 4 true If the rectangle is accepted, or has been changed to an accepted one\&. .RE .PP .PP Reimplemented from \fBQwtPicker\fP\&. .SS "void QwtPlotZoomer::begin ()\fC [protected]\fP, \fC [virtual]\fP" Rejects selections, when the stack depth is too deep, or the zoomed rectangle is \fBminZoomSize()\fP\&. .PP \fBSee also\fP .RS 4 \fBminZoomSize()\fP, \fBmaxStackDepth()\fP .RE .PP .PP Reimplemented from \fBQwtPicker\fP\&. .SS "bool QwtPlotZoomer::end (bool ok = \fCtrue\fP)\fC [protected]\fP, \fC [virtual]\fP" Expand the selected rectangle to \fBminZoomSize()\fP and zoom in if accepted\&. .PP \fBParameters\fP .RS 4 \fIok\fP If true, complete the selection and emit selected signals otherwise discard the selection\&. .RE .PP \fBSee also\fP .RS 4 \fBaccept()\fP, \fBminZoomSize()\fP .RE .PP \fBReturns\fP .RS 4 True if the selection has been accepted, false otherwise .RE .PP .PP Reimplemented from \fBQwtPlotPicker\fP\&. .SS "int QwtPlotZoomer::maxStackDepth () const" .PP \fBReturns\fP .RS 4 Maximal depth of the zoom stack\&. .RE .PP \fBSee also\fP .RS 4 \fBsetMaxStackDepth()\fP .RE .PP .SS "QSizeF QwtPlotZoomer::minZoomSize () const\fC [protected]\fP, \fC [virtual]\fP" .PP Limit zooming by a minimum rectangle\&. .PP \fBReturns\fP .RS 4 \fBzoomBase()\fP\&.width() / 10e4, \fBzoomBase()\fP\&.height() / 10e4 .RE .PP .SS "void QwtPlotZoomer::moveBy (double dx, double dy)\fC [slot]\fP" Move the current zoom rectangle\&. .PP \fBParameters\fP .RS 4 \fIdx\fP X offset .br \fIdy\fP Y offset .RE .PP \fBNote\fP .RS 4 The changed rectangle is limited by the zoom base .RE .PP .SS "void QwtPlotZoomer::moveTo (const QPointF & pos)\fC [virtual]\fP, \fC [slot]\fP" Move the the current zoom rectangle\&. .PP \fBParameters\fP .RS 4 \fIpos\fP New position .RE .PP \fBSee also\fP .RS 4 QRectF::moveTo() .RE .PP \fBNote\fP .RS 4 The changed rectangle is limited by the zoom base .RE .PP .SS "void QwtPlotZoomer::rescale ()\fC [protected]\fP, \fC [virtual]\fP" Adjust the observed plot to \fBzoomRect()\fP .PP \fBNote\fP .RS 4 Initiates \fBQwtPlot::replot()\fP .RE .PP .SS "void QwtPlotZoomer::setAxis (int xAxis, int yAxis)\fC [virtual]\fP" Reinitialize the axes, and set the zoom base to their scales\&. .PP \fBParameters\fP .RS 4 \fIxAxis\fP X axis .br \fIyAxis\fP Y axis .RE .PP .PP Reimplemented from \fBQwtPlotPicker\fP\&. .SS "void QwtPlotZoomer::setMaxStackDepth (int depth)" .PP Limit the number of recursive zoom operations to depth\&. A value of -1 set the depth to unlimited, 0 disables zooming\&. If the current zoom rectangle is below depth, the plot is unzoomed\&. .PP \fBParameters\fP .RS 4 \fIdepth\fP Maximum for the stack depth .RE .PP \fBSee also\fP .RS 4 \fBmaxStackDepth()\fP .RE .PP \fBNote\fP .RS 4 depth doesn't include the zoom base, so \fBzoomStack()\fP\&.count() might be \fBmaxStackDepth()\fP + 1\&. .RE .PP .SS "void QwtPlotZoomer::setZoomBase (bool doReplot = \fCtrue\fP)\fC [virtual]\fP" Reinitialized the zoom stack with \fBscaleRect()\fP as base\&. .PP \fBParameters\fP .RS 4 \fIdoReplot\fP Call \fBQwtPlot::replot()\fP for the attached plot before initializing the zoomer with its scales\&. This might be necessary, when the plot is in a state with pending scale changes\&. .RE .PP \fBSee also\fP .RS 4 \fBzoomBase()\fP, \fBscaleRect()\fP \fBQwtPlot::autoReplot()\fP, \fBQwtPlot::replot()\fP\&. .RE .PP .SS "void QwtPlotZoomer::setZoomBase (const QRectF & base)\fC [virtual]\fP" .PP Set the initial size of the zoomer\&. base is united with the current \fBscaleRect()\fP and the zoom stack is reinitialized with it as zoom base\&. plot is zoomed to \fBscaleRect()\fP\&. .PP \fBParameters\fP .RS 4 \fIbase\fP Zoom base .RE .PP \fBSee also\fP .RS 4 \fBzoomBase()\fP, \fBscaleRect()\fP .RE .PP .SS "void QwtPlotZoomer::setZoomStack (const QStack< QRectF > & zoomStack, int zoomRectIndex = \fC\-1\fP)" .PP Assign a zoom stack\&. In combination with other types of navigation it might be useful to modify to manipulate the complete zoom stack\&. .PP \fBParameters\fP .RS 4 \fIzoomStack\fP New zoom stack .br \fIzoomRectIndex\fP Index of the current position of zoom stack\&. In case of -1 the current position is at the top of the stack\&. .RE .PP \fBNote\fP .RS 4 The zoomed signal might be emitted\&. .RE .PP \fBSee also\fP .RS 4 \fBzoomStack()\fP, \fBzoomRectIndex()\fP .RE .PP .SS "void QwtPlotZoomer::widgetKeyPressEvent (QKeyEvent * ke)\fC [protected]\fP, \fC [virtual]\fP" Qt::Key_Plus zooms in, Qt::Key_Minus zooms out one position on the zoom stack, Qt::Key_Escape zooms out to the zoom base\&. .PP Changes the current position on the stack, but doesn't pop any rectangle\&. .PP \fBNote\fP .RS 4 The keys codes can be changed, using \fBQwtEventPattern::setKeyPattern\fP: 3, 4, 5 .RE .PP .PP Reimplemented from \fBQwtPicker\fP\&. .SS "void QwtPlotZoomer::widgetMouseReleaseEvent (QMouseEvent * me)\fC [protected]\fP, \fC [virtual]\fP" Qt::MidButton zooms out one position on the zoom stack, Qt::RightButton to the zoom base\&. .PP Changes the current position on the stack, but doesn't pop any rectangle\&. .PP \fBNote\fP .RS 4 The mouse events can be changed, using \fBQwtEventPattern::setMousePattern\fP: 2, 1 .RE .PP .PP Reimplemented from \fBQwtPicker\fP\&. .SS "void QwtPlotZoomer::zoom (const QRectF & rect)\fC [virtual]\fP, \fC [slot]\fP" .PP Zoom in\&. Clears all rectangles above the current position of the zoom stack and pushes the normalized rectangle on it\&. .PP \fBNote\fP .RS 4 If the maximal stack depth is reached, zoom is ignored\&. .PP The zoomed signal is emitted\&. .RE .PP .SS "void QwtPlotZoomer::zoom (int offset)\fC [virtual]\fP, \fC [slot]\fP" .PP Zoom in or out\&. Activate a rectangle on the zoom stack with an offset relative to the current position\&. Negative values of offset will zoom out, positive zoom in\&. A value of 0 zooms out to the zoom base\&. .PP \fBParameters\fP .RS 4 \fIoffset\fP Offset relative to the current position of the zoom stack\&. .RE .PP \fBNote\fP .RS 4 The zoomed signal is emitted\&. .RE .PP \fBSee also\fP .RS 4 \fBzoomRectIndex()\fP .RE .PP .SS "QRectF QwtPlotZoomer::zoomBase () const" .PP \fBReturns\fP .RS 4 Initial rectangle of the zoomer .RE .PP \fBSee also\fP .RS 4 \fBsetZoomBase()\fP, \fBzoomRect()\fP .RE .PP .SS "void QwtPlotZoomer::zoomed (const QRectF & rect)\fC [signal]\fP" A signal emitting the \fBzoomRect()\fP, when the plot has been zoomed in or out\&. .PP \fBParameters\fP .RS 4 \fIrect\fP Current zoom rectangle\&. .RE .PP .SS "QRectF QwtPlotZoomer::zoomRect () const" .PP \fBReturns\fP .RS 4 Rectangle at the current position on the zoom stack\&. .RE .PP \fBSee also\fP .RS 4 \fBzoomRectIndex()\fP, \fBscaleRect()\fP\&. .RE .PP .SS "uint QwtPlotZoomer::zoomRectIndex () const" .PP \fBReturns\fP .RS 4 Index of current position of zoom stack\&. .RE .PP .SS "const QStack< QRectF > & QwtPlotZoomer::zoomStack () const" .PP \fBReturns\fP .RS 4 The zoom stack\&. \fBzoomStack()\fP[0] is the zoom base, \fBzoomStack()\fP[1] the first zoomed rectangle\&. .RE .PP \fBSee also\fP .RS 4 \fBsetZoomStack()\fP, \fBzoomRectIndex()\fP .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Qwt User's Guide from the source code\&.