Public Member Functions | Protected Member Functions | Private Attributes | List of all members
PlotZoomer Class Reference

#include <plotzoomer.h>

Inheritance diagram for PlotZoomer:
Inheritance graph
[legend]

Public Member Functions

void keepAspectRatio (bool doKeep)
 
 PlotZoomer ()
 
 PlotZoomer (QWidget *)
 
virtual ~PlotZoomer () override=default
 
- Public Member Functions inherited from QwtPlotZoomer
int maxStackDepth () const
 
 QwtPlotZoomer (QWidget *, bool doReplot=true)
 Create a zoomer for a plot canvas. More...
 
 QwtPlotZoomer (QwtAxisId xAxis, QwtAxisId yAxis, QWidget *, bool doReplot=true)
 Create a zoomer for a plot canvas. More...
 
virtual void setAxes (QwtAxisId xAxis, QwtAxisId yAxis) QWT_OVERRIDE
 
void setMaxStackDepth (int)
 Limit the number of recursive zoom operations to depth. More...
 
virtual void setZoomBase (bool doReplot=true)
 
virtual void setZoomBase (const QRectF &)
 Set the initial size of the zoomer. More...
 
void setZoomStack (const QStack< QRectF > &, int zoomRectIndex=-1)
 Assign a zoom stack. More...
 
QRectF zoomBase () const
 
QRectF zoomRect () const
 
uint zoomRectIndex () const
 
const QStack< QRectF > & zoomStack () const
 
virtual ~QwtPlotZoomer ()
 
- Public Member Functions inherited from QwtPlotPicker
QWidget * canvas ()
 
const QWidget * canvas () const
 
QwtPlotplot ()
 
const QwtPlotplot () const
 
 QwtPlotPicker (QWidget *canvas)
 Create a plot picker. More...
 
 QwtPlotPicker (QwtAxisId xAxisId, QwtAxisId yAxisId, QWidget *)
 
 QwtPlotPicker (QwtAxisId xAxisId, QwtAxisId yAxisId, RubberBand rubberBand, DisplayMode trackerMode, QWidget *)
 
QwtAxisId xAxis () const
 Return x axis. More...
 
QwtAxisId yAxis () const
 Return y axis. More...
 
virtual ~QwtPlotPicker ()
 Destructor. More...
 
- Public Member Functions inherited from QwtPicker
virtual void drawRubberBand (QPainter *) const
 
virtual void drawTracker (QPainter *) const
 
virtual bool eventFilter (QObject *, QEvent *) QWT_OVERRIDE
 Event filter. More...
 
bool isActive () const
 
bool isEnabled () const
 
QWidget * parentWidget ()
 Return the parent widget, where the selection happens. More...
 
const QWidget * parentWidget () const
 
virtual QPainterPath pickArea () const
 
 QwtPicker (QWidget *parent)
 
 QwtPicker (RubberBand rubberBand, DisplayMode trackerMode, QWidget *)
 
ResizeMode resizeMode () const
 
RubberBand rubberBand () const
 
virtual QRegion rubberBandMask () const
 
QPen rubberBandPen () const
 
QPolygon selection () const
 
void setResizeMode (ResizeMode)
 Set the resize mode. More...
 
void setRubberBand (RubberBand)
 
void setRubberBandPen (const QPen &)
 
void setStateMachine (QwtPickerMachine *)
 
void setTrackerFont (const QFont &)
 
void setTrackerMode (DisplayMode)
 Set the display mode of the tracker. More...
 
void setTrackerPen (const QPen &)
 
QwtPickerMachinestateMachine ()
 
const QwtPickerMachinestateMachine () const
 
QFont trackerFont () const
 
virtual QRegion trackerMask () const
 
DisplayMode trackerMode () const
 
QPen trackerPen () const
 
QPoint trackerPosition () const
 
virtual QRect trackerRect (const QFont &) const
 
virtual ~QwtPicker ()
 Destructor. More...
 
- Public Member Functions inherited from QwtEventPattern
void initKeyPattern ()
 
void initMousePattern (int numButtons)
 
bool keyMatch (KeyPatternCode, const QKeyEvent *) const
 Compare a key event with an event pattern. More...
 
QVector< KeyPattern > & keyPattern ()
 
const QVector< KeyPattern > & keyPattern () const
 
bool mouseMatch (MousePatternCode, const QMouseEvent *) const
 Compare a mouse event with an event pattern. More...
 
QVector< MousePattern > & mousePattern ()
 
const QVector< MousePattern > & mousePattern () const
 
 QwtEventPattern ()
 
void setKeyPattern (const QVector< KeyPattern > &)
 Change the key event patterns. More...
 
void setKeyPattern (KeyPatternCode, int key, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
 
void setMousePattern (const QVector< MousePattern > &)
 Change the mouse event patterns. More...
 
void setMousePattern (MousePatternCode, Qt::MouseButton button, Qt::KeyboardModifiers=Qt::NoModifier)
 
virtual ~QwtEventPattern ()
 Destructor. More...
 

Protected Member Functions

virtual bool accept (QPolygon &) const override
 Check and correct a selected rectangle. More...
 
virtual QSizeF minZoomSize () const override
 Limit zooming by a minimum rectangle. More...
 
virtual void widgetMouseMoveEvent (QMouseEvent *event) override
 
virtual void widgetMousePressEvent (QMouseEvent *event) override
 
virtual void widgetMouseReleaseEvent (QMouseEvent *event) override
 
virtual void zoom (const QRectF &rect) override
 Zoom in. More...
 
- Protected Member Functions inherited from QwtPlotZoomer
virtual void begin () QWT_OVERRIDE
 
virtual bool end (bool ok=true) QWT_OVERRIDE
 
virtual void rescale ()
 
virtual void widgetKeyPressEvent (QKeyEvent *) QWT_OVERRIDE
 
- Protected Member Functions inherited from QwtPlotPicker
virtual void append (const QPoint &) QWT_OVERRIDE
 
QPointF invTransform (const QPoint &) const
 
QRectF invTransform (const QRect &) const
 
virtual void move (const QPoint &) QWT_OVERRIDE
 
QRectF scaleRect () const
 
virtual QwtText trackerText (const QPoint &) const QWT_OVERRIDE
 
virtual QwtText trackerTextF (const QPointF &) const
 Translate a position into a position string. More...
 
QPoint transform (const QPointF &) const
 
QRect transform (const QRectF &) const
 
- Protected Member Functions inherited from QwtPicker
virtual QPolygon adjustedPoints (const QPolygon &) const
 Map the pickedPoints() into a selection() More...
 
const QPolygon & pickedPoints () const
 
virtual void remove ()
 
virtual void reset ()
 
const QwtWidgetOverlayrubberBandOverlay () const
 
virtual void stretchSelection (const QSize &oldSize, const QSize &newSize)
 
const QwtWidgetOverlaytrackerOverlay () const
 
QRect trackerRect (const QSize &) const
 
virtual void transition (const QEvent *)
 
virtual void updateDisplay ()
 Update the state of rubber band and tracker label. More...
 
virtual void widgetEnterEvent (QEvent *)
 
virtual void widgetKeyReleaseEvent (QKeyEvent *)
 
virtual void widgetLeaveEvent (QEvent *)
 
virtual void widgetMouseDoubleClickEvent (QMouseEvent *)
 
virtual void widgetWheelEvent (QWheelEvent *)
 
- Protected Member Functions inherited from QwtEventPattern
virtual bool keyMatch (const KeyPattern &, const QKeyEvent *) const
 Compare a key event with an event pattern. More...
 
virtual bool mouseMatch (const MousePattern &, const QMouseEvent *) const
 Compare a mouse event with an event pattern. More...
 

Private Attributes

QPoint _initial_pos
 
bool _keep_aspect_ratio
 
bool _mouse_pressed
 
bool _zoom_enabled
 

Additional Inherited Members

- Public Types inherited from QwtPicker
enum  DisplayMode { AlwaysOff, AlwaysOn, ActiveOnly }
 Display mode. More...
 
enum  ResizeMode { Stretch, KeepSize }
 
enum  RubberBand {
  NoRubberBand = 0, HLineRubberBand, VLineRubberBand, CrossRubberBand,
  RectRubberBand, EllipseRubberBand, PolygonRubberBand, UserRubberBand = 100
}
 
- Public Types inherited from QwtEventPattern
enum  KeyPatternCode {
  KeySelect1, KeySelect2, KeyAbort, KeyLeft,
  KeyRight, KeyUp, KeyDown, KeyRedo,
  KeyUndo, KeyHome, KeyPatternCount
}
 Symbolic keyboard input codes. More...
 
enum  MousePatternCode {
  MouseSelect1, MouseSelect2, MouseSelect3, MouseSelect4,
  MouseSelect5, MouseSelect6, MousePatternCount
}
 Symbolic mouse input codes. More...
 
- Public Slots inherited from QwtPlotZoomer
void moveBy (double dx, double dy)
 
virtual void moveTo (const QPointF &)
 
virtual void zoom (int offset)
 Zoom in or out. More...
 
- Public Slots inherited from QwtPicker
void setEnabled (bool)
 En/disable the picker. More...
 
- Signals inherited from QwtPlotZoomer
void zoomed (const QRectF &rect)
 
- Signals inherited from QwtPlotPicker
void appended (const QPointF &pos)
 
void moved (const QPointF &pos)
 
void selected (const QPointF &pos)
 
void selected (const QRectF &rect)
 
void selected (const QVector< QPointF > &pa)
 
- Signals inherited from QwtPicker
void activated (bool on)
 
void appended (const QPoint &pos)
 
void changed (const QPolygon &selection)
 
void moved (const QPoint &pos)
 
void removed (const QPoint &pos)
 
void selected (const QPolygon &polygon)
 
- Properties inherited from QwtPicker
bool isEnabled
 
ResizeMode resizeMode
 
RubberBand rubberBand
 
QPen rubberBandPen
 
QFont trackerFont
 
DisplayMode trackerMode
 
QPen trackerPen
 

Detailed Description

Definition at line 15 of file plotzoomer.h.

Constructor & Destructor Documentation

◆ PlotZoomer() [1/2]

PlotZoomer::PlotZoomer ( )

◆ PlotZoomer() [2/2]

PlotZoomer::PlotZoomer ( QWidget *  canvas)
explicit

Definition at line 18 of file plotzoomer.cpp.

◆ ~PlotZoomer()

virtual PlotZoomer::~PlotZoomer ( )
overridevirtualdefault

Member Function Documentation

◆ accept()

bool PlotZoomer::accept ( QPolygon &  pa) const
overrideprotectedvirtual

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

Definition at line 92 of file plotzoomer.cpp.

◆ keepAspectRatio()

void PlotZoomer::keepAspectRatio ( bool  doKeep)
inline

Definition at line 24 of file plotzoomer.h.

◆ minZoomSize()

QSizeF PlotZoomer::minZoomSize ( ) const
overrideprotectedvirtual

Limit zooming by a minimum rectangle.

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

Reimplemented from QwtPlotZoomer.

Definition at line 138 of file plotzoomer.cpp.

◆ widgetMouseMoveEvent()

void PlotZoomer::widgetMouseMoveEvent ( QMouseEvent *  mouseEvent)
overrideprotectedvirtual

Handle a mouse move event for the observed widget.

Parameters
mouseEventMouse event
See also
eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(), widgetMouseDoubleClickEvent(), widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent()

Reimplemented from QwtPicker.

Definition at line 44 of file plotzoomer.cpp.

◆ widgetMousePressEvent()

void PlotZoomer::widgetMousePressEvent ( QMouseEvent *  mouseEvent)
overrideprotectedvirtual

Handle a mouse press event for the observed widget.

Parameters
mouseEventMouse event
See also
eventFilter(), widgetMouseReleaseEvent(), widgetMouseDoubleClickEvent(), widgetMouseMoveEvent(), widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent()

Reimplemented from QwtPicker.

Definition at line 27 of file plotzoomer.cpp.

◆ widgetMouseReleaseEvent()

void PlotZoomer::widgetMouseReleaseEvent ( QMouseEvent *  me)
overrideprotectedvirtual

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

Definition at line 84 of file plotzoomer.cpp.

◆ zoom()

void PlotZoomer::zoom ( const QRectF &  rect)
overrideprotectedvirtual

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.

Reimplemented from QwtPlotZoomer.

Definition at line 110 of file plotzoomer.cpp.

Member Data Documentation

◆ _initial_pos

QPoint PlotZoomer::_initial_pos
private

Definition at line 43 of file plotzoomer.h.

◆ _keep_aspect_ratio

bool PlotZoomer::_keep_aspect_ratio
private

Definition at line 42 of file plotzoomer.h.

◆ _mouse_pressed

bool PlotZoomer::_mouse_pressed
private

Definition at line 40 of file plotzoomer.h.

◆ _zoom_enabled

bool PlotZoomer::_zoom_enabled
private

Definition at line 41 of file plotzoomer.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50