logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

QwtPlotZoomer - QwtPlotZoomer provides stacked zooming for a plot widget.

Author

       Generated automatically by Doxygen for Qwt User's Guide from the source code.

Version 6.1.4                                    Wed Jan 2 2019                                 QwtPlotZoomer(3)

Constructor & Destructor Documentation

QwtPlotZoomer::QwtPlotZoomer(QWidget*canvas,booldoReplot=true)[explicit]
       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 QwtPlot::xBottom. If both
       or no y-axis are enabled, it is set to QwtPlot::yLeft.

       The   zoomer   is   initialized   with   a   QwtPickerDragRectMachine,   the   tracker  mode  is  set  to
       QwtPicker::ActiveOnly and the rubber band is set to QwtPicker::RectRubberBandParameters:canvas Plot canvas to observe, also the parent object
           doReplot Call QwtPlot::replot() 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.

       Seealso:QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()QwtPlotZoomer::QwtPlotZoomer(intxAxis,intyAxis,QWidget*canvas,booldoReplot=true)[explicit]
       Create a zoomer for a plot canvas. The zoomer is initialized with a QwtPickerDragRectMachine, the tracker
       mode is set to QwtPicker::ActiveOnly and the rubber band is set to QwtPicker;;RectRubberBand

       Parameters:xAxis X axis of the zoomer
           yAxis Y axis of the zoomer
           canvas Plot canvas to observe, also the parent object
           doReplot Call QwtPlot::replot() 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.

       Seealso:QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()

Detailed Description

QwtPlotZoomer provides stacked zooming for a plot widget.

       QwtPlotZoomer 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.

       Zooming can be repeated as often as possible, limited only by maxStackDepth() or minZoomSize(). Each
       rectangle is pushed on a stack.

       The default setting how to select rectangles is a QwtPickerDragRectMachine with the following bindings:

       • QwtEventPattern::MouseSelect1
          The  first  point  of  the  zoom  rectangle  is  selected  by a mouse press, the second point from the
         position, where the mouse is released.

       • QwtEventPattern::KeySelect1
          The first key press selects the first, the second key press selects the second point.

       • QwtEventPattern::KeyAbort
          Discard the selection in the state, where the first point is selected.

       To traverse the zoom stack the following bindings are used:

       • QwtEventPattern::MouseSelect3, QwtEventPattern::KeyUndo
          Zoom out one position on the zoom stack

       • QwtEventPattern::MouseSelect6, QwtEventPattern::KeyRedo
          Zoom in one position on the zoom stack

       • QwtEventPattern::MouseSelect2, QwtEventPattern::KeyHome
          Zoom to the zoom base

       The setKeyPattern() and setMousePattern() 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.

       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 );

       QwtPlotZoomer  is  tailored  for  plots  with  one  x  and  y  axis, but it is allowed to attach a second
       QwtPlotZoomer ( without rubber band and tracker ) for the other axes.

       Note:
           The realtime example includes an derived zoomer class that adds scrollbars to the plot canvas.

       Seealso:QwtPlotPanner, QwtPlotMagnifier

Member Function Documentation

boolQwtPlotZoomer::accept(QPolygon&pa)const[protected],[virtual]
       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.

       Returns:
           true If the rectangle is accepted, or has been changed to an accepted one.

       Reimplemented from QwtPicker.

   voidQwtPlotZoomer::begin()[protected],[virtual]
       Rejects selections, when the stack depth is too deep, or the zoomed rectangle is minZoomSize().

       Seealso:minZoomSize(), maxStackDepth()

       Reimplemented from QwtPicker.

   boolQwtPlotZoomer::end(boolok=true)[protected],[virtual]
       Expand the selected rectangle to minZoomSize() and zoom in if accepted.

       Parameters:ok If true, complete the selection and emit selected signals otherwise discard the selection.

       Seealso:accept(), minZoomSize()Returns:
           True if the selection has been accepted, false otherwise

       Reimplemented from QwtPlotPicker.

   intQwtPlotZoomer::maxStackDepth()constReturns:
           Maximal depth of the zoom stack.

       Seealso:setMaxStackDepth()QSizeFQwtPlotZoomer::minZoomSize()const[protected],[virtual]
       Limit zooming by a minimum rectangle.

       Returns:zoomBase().width() / 10e4, zoomBase().height() / 10e4

   voidQwtPlotZoomer::moveBy(doubledx,doubledy)[slot]
       Move the current zoom rectangle.

       Parameters:dx X offset
           dy Y offset

       Note:
           The changed rectangle is limited by the zoom base

   voidQwtPlotZoomer::moveTo(constQPointF&pos)[virtual],[slot]
       Move the the current zoom rectangle.

       Parameters:pos New position

       Seealso:
           QRectF::moveTo()

       Note:
           The changed rectangle is limited by the zoom base

   voidQwtPlotZoomer::rescale()[protected],[virtual]
       Adjust the observed plot to zoomRect()Note:
           Initiates QwtPlot::replot()voidQwtPlotZoomer::setAxis(intxAxis,intyAxis)[virtual]
       Reinitialize the axes, and set the zoom base to their scales.

       Parameters:xAxis X axis
           yAxis Y axis

       Reimplemented from QwtPlotPicker.

   voidQwtPlotZoomer::setMaxStackDepth(intdepth)
       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.

       Parameters:depth Maximum for the stack depth

       Seealso:maxStackDepth()Note:
           depth doesn't include the zoom base, so zoomStack().count() might be maxStackDepth() + 1.

   voidQwtPlotZoomer::setZoomBase(booldoReplot=true)[virtual]
       Reinitialized the zoom stack with scaleRect() as base.

       Parameters:doReplot Call QwtPlot::replot() 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.

       Seealso:zoomBase(), scaleRect()QwtPlot::autoReplot(), QwtPlot::replot().

   voidQwtPlotZoomer::setZoomBase(constQRectF&base)[virtual]
       Set the initial size of the zoomer. base is united with the current scaleRect() and  the  zoom  stack  is
       reinitialized with it as zoom base. plot is zoomed to scaleRect().

       Parameters:base Zoom base

       Seealso:zoomBase(), scaleRect()voidQwtPlotZoomer::setZoomStack(constQStack<QRectF>&zoomStack,intzoomRectIndex=-1)
       Assign  a  zoom  stack.  In  combination  with  other types of navigation it might be useful to modify to
       manipulate the complete zoom stack.

       Parameters:zoomStack New zoom stack
           zoomRectIndex Index of the current position of zoom stack. In case of -1 the current position  is  at
           the top of the stack.

       Note:
           The zoomed signal might be emitted.

       Seealso:zoomStack(), zoomRectIndex()voidQwtPlotZoomer::widgetKeyPressEvent(QKeyEvent*ke)[protected],[virtual]
       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.

       Changes the current position on the stack, but doesn't pop any rectangle.

       Note:
           The keys codes can be changed, using QwtEventPattern::setKeyPattern: 3, 4, 5

       Reimplemented from QwtPicker.

   voidQwtPlotZoomer::widgetMouseReleaseEvent(QMouseEvent*me)[protected],[virtual]
       Qt::MidButton zooms out one position on the zoom stack, Qt::RightButton to the zoom base.

       Changes the current position on the stack, but doesn't pop any rectangle.

       Note:
           The mouse events can be changed, using QwtEventPattern::setMousePattern: 2, 1

       Reimplemented from QwtPicker.

   voidQwtPlotZoomer::zoom(constQRectF&rect)[virtual],[slot]
       Zoom in. Clears all rectangles above the current position of the zoom stack  and  pushes  the  normalized
       rectangle on it.

       Note:
           If the maximal stack depth is reached, zoom is ignored.

           The zoomed signal is emitted.

   voidQwtPlotZoomer::zoom(intoffset)[virtual],[slot]
       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.

       Parameters:offset Offset relative to the current position of the zoom stack.

       Note:
           The zoomed signal is emitted.

       Seealso:zoomRectIndex()QRectFQwtPlotZoomer::zoomBase()constReturns:
           Initial rectangle of the zoomer

       Seealso:setZoomBase(), zoomRect()voidQwtPlotZoomer::zoomed(constQRectF&rect)[signal]
       A signal emitting the zoomRect(), when the plot has been zoomed in or out.

       Parameters:rect Current zoom rectangle.

   QRectFQwtPlotZoomer::zoomRect()constReturns:
           Rectangle at the current position on the zoom stack.

       Seealso:zoomRectIndex(), scaleRect().

   uintQwtPlotZoomer::zoomRectIndex()constReturns:
           Index of current position of zoom stack.

   constQStack<QRectF>&QwtPlotZoomer::zoomStack()constReturns:
           The zoom stack. zoomStack()[0] is the zoom base, zoomStack()[1] the first zoomed rectangle.

       Seealso:setZoomStack(), zoomRectIndex()

Name

       QwtPlotZoomer - QwtPlotZoomer provides stacked zooming for a plot widget.

Synopsis

       #include <qwt_plot_zoomer.h>

       Inherits QwtPlotPicker.

   PublicSlots
       void moveBy (double dx, double dy)
       virtual void moveTo (const QPointF &)
       virtual void zoom (const QRectF &)
           Zoom in.
       virtual void zoom (int offset)
           Zoom in or out.

   Signals
       void zoomed (const QRectF &rect)

   PublicMemberFunctionsQwtPlotZoomer (QWidget *, bool doReplot=true)
           Create a zoomer for a plot canvas.
       QwtPlotZoomer (int xAxis, int yAxis, QWidget *, bool doReplot=true)
           Create a zoomer for a plot canvas.
       virtual void setZoomBase (bool doReplot=true)
       virtual void setZoomBase (const QRectF &)
           Set the initial size of the zoomer.
       QRectF zoomBase () const
       QRectF zoomRect () const
       virtual void setAxis (int xAxis, int yAxis)
       void setMaxStackDepth (int)
           Limit the number of recursive zoom operations to depth.
       int maxStackDepth () const
       const QStack< QRectF > & zoomStack () const
       void setZoomStack (const QStack< QRectF > &, int zoomRectIndex=-1)
           Assign a zoom stack.
       uint zoomRectIndex () const

   ProtectedMemberFunctions
       virtual void rescale ()
       virtual QSizeF minZoomSize () const
           Limit zooming by a minimum rectangle.
       virtual void widgetMouseReleaseEvent (QMouseEvent *)
       virtual void widgetKeyPressEvent (QKeyEvent *)
       virtual void begin ()
       virtual bool end (bool ok=true)
       virtual bool accept (QPolygon &) const
           Check and correct a selected rectangle.

   AdditionalInheritedMembers

See Also