Logo Search packages:      
Sourcecode: pcp-gui version File versions

QwtPlotZoomer Class Reference

#include <qwt_plot_zoomer.h>

Inheritance diagram for QwtPlotZoomer:

QwtPlotPicker QwtPicker QwtEventPattern

List of all members.

Detailed Description

QwtPlotZoomer provides stacked zooming for a plot widget.

QwtPlotZoomer offers rubberband selections on the plot canvas, translating the selected rectangles into plot coordinates and adjusting the axes to them. Zooming can repeated as often as possible, limited only by maxStackDepth() or minZoomSize(). Each rectangle is pushed on a stack.

Zoom rectangles can be selected depending on selectionFlags() using the mouse or keyboard (QwtEventPattern, QwtPickerMachine). QwtEventPattern::MouseSelect3/QwtEventPatternKeyUndo, or QwtEventPattern::MouseSelect6/QwtEventPatternKeyRedo walk up and down the zoom stack. QwtEventPattern::MouseSelect2 or QwtEventPattern::KeyHome unzoom to the initial size.

QwtPlotZoomer is tailored for plots with one x and y axis, but it is allowed to attach a second QwtPlotZoomer for the other axes.

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

Definition at line 49 of file qwt_plot_zoomer.h.

Public Types

enum  DisplayMode { AlwaysOff, AlwaysOn, ActiveOnly }
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...
enum  RectSelectionType { CornerToCorner = 64, CenterToCorner = 128, CenterToRadius = 256 }
 Selection subtype for RectSelection This enum type describes the type of rectangle selections. It can be orīd with QwtPicker::RectSelectionType and QwtPicker::SelectionMode and passed to QwtPicker::setSelectionFlags().
  • CornerToCorner
    The first and the second selected point are the corners of the rectangle.
  • CenterToCorner
    The first point is the center, the second a corner of the rectangle.
  • CenterToRadius
    The first point is the center of a quadrat, calculated by the maximum of the x- and y-distance.
enum  ResizeMode { Stretch, KeepSize }
enum  RubberBand {
  NoRubberBand = 0, HLineRubberBand, VLineRubberBand, CrossRubberBand,
  RectRubberBand, EllipseRubberBand, PolygonRubberBand, UserRubberBand = 100
enum  SelectionMode { ClickSelection = 1024, DragSelection = 2048 }
enum  SelectionType { NoSelection = 0, PointSelection = 1, RectSelection = 2, PolygonSelection = 4 }

Public Slots

virtual void move (double x, double y)
void moveBy (double x, double y)
virtual void zoom (int up)
 Zoom in or out.
virtual void zoom (const QwtDoubleRect &)
 Zoom in.


void appended (const QPoint &pos)
void appended (const QwtDoublePoint &pos)
void changed (const QwtPolygon &pa)
void moved (const QPoint &pos)
void moved (const QwtDoublePoint &pos)
void selected (const QwtPolygon &pa)
void selected (const QwtArray< QwtDoublePoint > &pa)
void selected (const QwtDoubleRect &rect)
void selected (const QwtDoublePoint &pos)
void zoomed (const QwtDoubleRect &rect)

Public Member Functions

const QwtPlotCanvascanvas () const
 Return Observed plot canvas.
QwtPlotCanvascanvas ()
 Return observed plot canvas.
virtual void drawRubberBand (QPainter *) const
virtual void drawTracker (QPainter *) const
virtual bool eventFilter (QObject *, QEvent *)
 Event filter.
void initKeyPattern ()
void initMousePattern (int numButtons)
bool isActive () const
bool isEnabled () const
bool keyMatch (uint pattern, const QKeyEvent *) const
 Compare a key event with an event pattern.
QwtArray< KeyPattern > & keyPattern ()
 Return Key patterns.
const QwtArray< KeyPattern > & keyPattern () const
 Return key patterns.
int maxStackDepth () const
bool mouseMatch (uint pattern, const QMouseEvent *) const
 Compare a mouse event with an event pattern.
QwtArray< MousePattern > & mousePattern ()
 Return ,ouse patterns.
const QwtArray< MousePattern > & mousePattern () const
 Return mouse patterns.
const QWidget * parentWidget () const
 Return the parent widget, where the selection happens.
QWidget * parentWidget ()
 Return the parent widget, where the selection happens.
virtual QRect pickRect () const
const QwtPlotplot () const
 Return plot widget, containing the observed plot canvas.
QwtPlotplot ()
 Return plot widget, containing the observed plot canvas.
 QwtPlotZoomer (int xAxis, int yAxis, int selectionFlags, DisplayMode trackerMode, QwtPlotCanvas *, bool doReplot=true)
 QwtPlotZoomer (int xAxis, int yAxis, QwtPlotCanvas *, bool doReplot=true)
 Create a zoomer for a plot canvas.
 QwtPlotZoomer (QwtPlotCanvas *, bool doReplot=true)
 Create a zoomer for a plot canvas.
ResizeMode resizeMode () const
RubberBand rubberBand () const
QPen rubberBandPen () const
const QwtPolygon & selection () const
 Return Selected points.
int selectionFlags () const
virtual void setAxis (int xAxis, int yAxis)
virtual void setEnabled (bool)
 En/disable the picker.
void setKeyPattern (const QwtArray< KeyPattern > &)
 Change the key event patterns.
void setKeyPattern (uint pattern, int key, int state=Qt::NoButton)
void setMaxStackDepth (int)
 Limit the number of recursive zoom operations to depth.
void setMousePattern (const QwtArray< MousePattern > &)
 Change the mouse event patterns.
void setMousePattern (uint pattern, int button, int state=Qt::NoButton)
virtual void setResizeMode (ResizeMode)
 Set the resize mode.
virtual void setRubberBand (RubberBand)
virtual void setRubberBandPen (const QPen &)
virtual void setSelectionFlags (int)
virtual void setTrackerFont (const QFont &)
virtual void setTrackerMode (DisplayMode)
 Set the display mode of the tracker.
virtual void setTrackerPen (const QPen &)
virtual void setZoomBase (const QwtDoubleRect &)
 Set the initial size of the zoomer.
virtual void setZoomBase ()
QFont trackerFont () const
DisplayMode trackerMode () const
QPen trackerPen () const
int xAxis () const
 Return x axis.
int yAxis () const
 Return y axis.
QwtDoubleRect zoomBase () const
QwtDoubleRect zoomRect () const
uint zoomRectIndex () const
const QValueStack
< QwtDoubleRect > & 
zoomStack () const

Protected Member Functions

virtual bool accept (QwtPolygon &) const
 Check and correct a selected rectangle.
virtual void append (const QPoint &)
virtual void begin ()
virtual bool end (bool ok=true)
QwtDoublePoint invTransform (const QPoint &) const
QwtDoubleRect invTransform (const QRect &) const
virtual bool keyMatch (const KeyPattern &, const QKeyEvent *) const
 Compare a key event with an event pattern.
virtual QwtDoubleSize minZoomSize () const
 Limit zooming by a minimum rectangle.
virtual bool mouseMatch (const MousePattern &, const QMouseEvent *) const
 Compare a mouse event with an event pattern.
virtual void move (const QPoint &)
virtual void rescale ()
const QWidget * rubberBandWidget () const
QwtDoubleRect scaleRect () const
virtual QwtPickerMachinestateMachine (int) const
virtual void stretchSelection (const QSize &oldSize, const QSize &newSize)
QRect trackerRect (QPainter *painter) const
virtual QwtText trackerText (const QwtDoublePoint &) const
 Translate a position into a position string.
virtual QwtText trackerText (const QPoint &) const
const QWidget * trackerWidget () const
QPoint transform (const QwtDoublePoint &) const
QRect transform (const QwtDoubleRect &) const
virtual void transition (const QEvent *)
virtual void updateDisplay ()
virtual void widgetKeyPressEvent (QKeyEvent *)
virtual void widgetKeyReleaseEvent (QKeyEvent *)
virtual void widgetLeaveEvent (QEvent *)
virtual void widgetMouseDoubleClickEvent (QMouseEvent *)
virtual void widgetMouseMoveEvent (QMouseEvent *)
virtual void widgetMousePressEvent (QMouseEvent *)
virtual void widgetMouseReleaseEvent (QMouseEvent *)
virtual void widgetWheelEvent (QWheelEvent *)


bool isEnabled
ResizeMode resizeMode
RubberBand rubberBand
QPen rubberBandPen
int selectionFlags
QFont trackerFont
DisplayMode trackerMode
QPen trackerPen

Private Member Functions

void init (int selectionFlags, DisplayMode trackerMode, bool doReplot)
 Init the zoomer, used by the constructors.

Private Attributes

PrivateData * d_data


class  PrivateData

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

Generated by  Doxygen 1.6.0   Back to index