Qwt User's Guide: QwtPlotMagnifier Class Reference

Qwt User's Guide 6.0.1

- Main Page
- Related Pages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# QwtPlotMagnifier Class Reference

QwtPlotMagnifier provides zooming, by magnifying in steps. More...

`#include <qwt_plot_magnifier.h>`

Inheritance diagram for QwtPlotMagnifier:
[legend]

List of all members.

## Public Member Functions
QwtPlotCanvas * | canvas ()
const QwtPlotCanvas * | canvas () const
virtual bool | eventFilter (QObject *, QEvent *)
void | getMouseButton (int &button, int &buttonState) const
void | getZoomInKey (int &key, int &modifiers) const
void | getZoomOutKey (int &key, int &modifiers) const
bool | isAxisEnabled (int axis) const
bool | isEnabled () const
double | keyFactor () const
double | mouseFactor () const
QWidget * | parentWidget ()
const QWidget * | parentWidget () const
const QwtPlot * | plot () const
QwtPlot * | plot ()
| QwtPlotMagnifier (QwtPlotCanvas *)
void | setAxisEnabled (int axis, bool on)
void | setEnabled (bool)
void | setKeyFactor (double)
void | setMouseButton (int button, int buttonState=Qt::NoButton)
void | setMouseFactor (double)
void | setWheelButtonState (int buttonState)
void | setWheelFactor (double)
void | setZoomInKey (int key, int modifiers)
void | setZoomOutKey (int key, int modifiers)
int | wheelButtonState () const
double | wheelFactor () const
virtual | ~QwtPlotMagnifier ()
## Protected Member Functions
virtual void | rescale (double factor)
virtual void | widgetKeyPressEvent (QKeyEvent *)
virtual void | widgetKeyReleaseEvent (QKeyEvent *)
virtual void | widgetMouseMoveEvent (QMouseEvent *)
virtual void | widgetMousePressEvent (QMouseEvent *)
virtual void | widgetMouseReleaseEvent (QMouseEvent *)
virtual void | widgetWheelEvent (QWheelEvent *)

## Detailed Description

QwtPlotMagnifier provides zooming, by magnifying in steps.

Using QwtPlotMagnifier a plot can be zoomed in/out in steps using keys, the mouse wheel or moving a mouse button in vertical direction.

Together with QwtPlotZoomer and QwtPlotPanner it is possible to implement individual and powerful navigation of the plot canvas.

See also:
  QwtPlotZoomer, QwtPlotPanner, QwtPlot

## Constructor & Destructor Documentation

QwtPlotMagnifier::QwtPlotMagnifier | ( | QwtPlotCanvas * | canvas | ) | `[explicit]`

Constructor

Parameters:

  canvas | Plot canvas to be magnified

QwtPlotMagnifier::~QwtPlotMagnifier | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

QwtPlotCanvas * QwtPlotMagnifier::canvas | ( |  | ) |

Return observed plot canvas.

const QwtPlotCanvas * QwtPlotMagnifier::canvas | ( |  | ) | const

Return Observed plot canvas.

bool QwtMagnifier::eventFilter | ( | QObject * | object,
|  | QEvent * | event
| ) |  | `[virtual, inherited]`

Event filter.

When isEnabled() the mouse events of the observed widget are filtered.

Parameters:

  object | Object to be filtered
  event | Event

See also:
  widgetMousePressEvent(), widgetMouseReleaseEvent(), widgetMouseMoveEvent(), widgetWheelEvent(), widgetKeyPressEvent() widgetKeyReleaseEvent()

void QwtMagnifier::getMouseButton | ( | int & | button,
|  | int & | buttonState
| ) |  | const`[inherited]`

See also:
  setMouseButton()

void QwtMagnifier::getZoomInKey | ( | int & | key,
|  | int & | modifiers
| ) |  | const`[inherited]`

See also:
  setZoomInKey()

void QwtMagnifier::getZoomOutKey | ( | int & | key,
|  | int & | modifiers
| ) |  | const`[inherited]`

See also:
  setZoomOutKey()

bool QwtPlotMagnifier::isAxisEnabled | ( | int | axis | ) | const

Test if an axis is enabled

Parameters:

  axis | Axis, see QwtPlot::Axis

Returns:
  True, if the axis is enabled

See also:
  setAxisEnabled()

bool QwtMagnifier::isEnabled | ( |  | ) | const`[inherited]`

Returns:
  true when enabled, false otherwise

See also:
  setEnabled(), eventFilter()

double QwtMagnifier::keyFactor | ( |  | ) | const`[inherited]`

Returns:
  Key factor

See also:
  setKeyFactor()

double QwtMagnifier::mouseFactor | ( |  | ) | const`[inherited]`

Returns:
  Mouse factor

See also:
  setMouseFactor()

QWidget * QwtMagnifier::parentWidget | ( |  | ) | `[inherited]`

Returns:
  Parent widget, where the rescaling happens

const QWidget * QwtMagnifier::parentWidget | ( |  | ) | const`[inherited]`

Returns:
  Parent widget, where the rescaling happens

QwtPlot * QwtPlotMagnifier::plot | ( |  | ) |

Return plot widget, containing the observed plot canvas.

const QwtPlot * QwtPlotMagnifier::plot | ( |  | ) | const

Return plot widget, containing the observed plot canvas.

void QwtPlotMagnifier::rescale | ( | double | factor | ) | `[protected, virtual]`

Zoom in/out the axes scales

Parameters:

  factor | A value < 1.0 zooms in, a value > 1.0 zooms out.

Implements QwtMagnifier.

void QwtPlotMagnifier::setAxisEnabled | ( | int | axis,
|  | bool | on
| ) |  |

En/Disable an axis.

Only Axes that are enabled will be zoomed. All other axes will remain unchanged.

Parameters:

  axis | Axis, see QwtPlot::Axis
  on | On/Off

See also:
  isAxisEnabled()

void QwtMagnifier::setEnabled | ( | bool | on | ) | `[inherited]`

En/disable the magnifier.

When enabled is true an event filter is installed for the observed widget, otherwise the event filter is removed.

Parameters:

  on | true or false

See also:
  isEnabled(), eventFilter()

void QwtMagnifier::setKeyFactor | ( | double | factor | ) | `[inherited]`

Change the key factor.

The key factor defines the ratio between the current range on the parent widget and the zoomed range for each key press of the zoom in/out keys. The default value is 0.9.

Parameters:

  factor | Key factor

See also:
  keyFactor(), setZoomInKey(), setZoomOutKey(), setWheelFactor, setMouseFactor()

void QwtMagnifier::setMouseButton | ( | int | button,
|  | int | buttonState = `Qt::NoButton`
| ) |  | `[inherited]`

Assign the mouse button, that is used for zooming in/out. The default value is Qt::RightButton.

Parameters:

  button | Button
  buttonState | Button state

See also:
  getMouseButton()

void QwtMagnifier::setMouseFactor | ( | double | factor | ) | `[inherited]`

Change the mouse factor.

The mouse factor defines the ratio between the current range on the parent widget and the zoomed range for each vertical mouse movement. The default value is 0.95.

Parameters:

  factor | Wheel factor

See also:
  mouseFactor(), setMouseButton(), setWheelFactor(), setKeyFactor()

void QwtMagnifier::setWheelButtonState | ( | int | buttonState | ) | `[inherited]`

Assign a mandatory button state for zooming in/out using the wheel. The default button state is Qt::NoButton.

Parameters:

  buttonState | Button state

See also:
  wheelButtonState()

void QwtMagnifier::setWheelFactor | ( | double | factor | ) | `[inherited]`

Change the wheel factor.

The wheel factor defines the ratio between the current range on the parent widget and the zoomed range for each step of the wheel. The default value is 0.9.

Parameters:

  factor | Wheel factor

See also:
  wheelFactor(), setWheelButtonState(), setMouseFactor(), setKeyFactor()

void QwtMagnifier::setZoomInKey | ( | int | key,
|  | int | modifiers
| ) |  | `[inherited]`

Assign the key, that is used for zooming in. The default combination is Qt::Key_Plus + Qt::NoModifier.

Parameters:

  key |
  modifiers |

See also:
  getZoomInKey(), setZoomOutKey()

void QwtMagnifier::setZoomOutKey | ( | int | key,
|  | int | modifiers
| ) |  | `[inherited]`

Assign the key, that is used for zooming out. The default combination is Qt::Key_Minus + Qt::NoModifier.

Parameters:

  key |
  modifiers |

See also:
  getZoomOutKey(), setZoomOutKey()

int QwtMagnifier::wheelButtonState | ( |  | ) | const`[inherited]`

Returns:
  Wheel button state

See also:
  setWheelButtonState()

double QwtMagnifier::wheelFactor | ( |  | ) | const`[inherited]`

Returns:
  Wheel factor

See also:
  setWheelFactor()

void QwtMagnifier::widgetKeyPressEvent | ( | QKeyEvent * | keyEvent | ) | `[protected, virtual, inherited]`

Handle a key press event for the observed widget.

Parameters:

  keyEvent | Key event

See also:
  eventFilter(), widgetKeyReleaseEvent()

void QwtMagnifier::widgetKeyReleaseEvent | ( | QKeyEvent * | keyEvent | ) | `[protected, virtual, inherited]`

Handle a key release event for the observed widget.

Parameters:

  keyEvent | Key event

See also:
  eventFilter(), widgetKeyReleaseEvent()

void QwtMagnifier::widgetMouseMoveEvent | ( | QMouseEvent * | mouseEvent | ) | `[protected, virtual, inherited]`

Handle a mouse move event for the observed widget.

Parameters:

  mouseEvent | Mouse event

See also:
  eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),

void QwtMagnifier::widgetMousePressEvent | ( | QMouseEvent * | mouseEvent | ) | `[protected, virtual, inherited]`

Handle a mouse press event for the observed widget.

Parameters:

  mouseEvent | Mouse event

See also:
  eventFilter(), widgetMouseReleaseEvent(), widgetMouseMoveEvent()

void QwtMagnifier::widgetMouseReleaseEvent | ( | QMouseEvent * | mouseEvent | ) | `[protected, virtual, inherited]`

Handle a mouse release event for the observed widget.

Parameters:

  mouseEvent | Mouse event

See also:
  eventFilter(), widgetMousePressEvent(), widgetMouseMoveEvent(),

void QwtMagnifier::widgetWheelEvent | ( | QWheelEvent * | wheelEvent | ) | `[protected, virtual, inherited]`

Handle a wheel event for the observed widget.

Parameters:

  wheelEvent | Wheel event

See also:
  eventFilter()