# QwtPlotPanner Class Reference

QwtPlotPanner provides panning of a plot canvas. More...

`#include <qwt_plot_panner.h>`

Inheritance diagram for QwtPlotPanner:
[legend]

List of all members.

## Signals

void | moved (int dx, int dy)
void | panned (int dx, int dy)

## Public Member Functions

QwtPlotCanvas * | canvas ()
const QwtPlotCanvas * | canvas () const
const QCursor | cursor () const
virtual bool | eventFilter (QObject *, QEvent *)
void | getAbortKey (int &key, int &state) const
void | getMouseButton (int &button, int &buttonState) const
bool | isAxisEnabled (int axis) const
bool | isEnabled () const
bool | isOrientationEnabled (Qt::Orientation) const
Qt::Orientations | orientations () const
QwtPlot * | plot ()
const QwtPlot * | plot () const
| QwtPlotPanner (QwtPlotCanvas *)
void | setAbortKey (int key, int state=Qt::NoButton)
void | setAxisEnabled (int axis, bool on)
void | setCursor (const QCursor &)
void | setEnabled (bool)
void | setMouseButton (int button, int buttonState=Qt::NoButton)
void | setOrientations (Qt::Orientations)
virtual | ~QwtPlotPanner ()

## Protected Slots

virtual void | moveCanvas (int dx, int dy)

## Protected Member Functions

virtual void | paintEvent (QPaintEvent *)
virtual void | widgetKeyPressEvent (QKeyEvent *)
virtual void | widgetKeyReleaseEvent (QKeyEvent *)
virtual void | widgetMouseMoveEvent (QMouseEvent *)
virtual void | widgetMousePressEvent (QMouseEvent *)
virtual void | widgetMouseReleaseEvent (QMouseEvent *)

## Detailed Description

QwtPlotPanner provides panning of a plot canvas.

QwtPlotPanner is a panner for a QwtPlotCanvas, that adjusts the scales of the axes after dropping the canvas on its new position.

Together with QwtPlotZoomer and QwtPlotMagnifier powerful ways of navigating on a QwtPlot widget can be implemented easily.

Note:
  The axes are not updated, while dragging the canvas

See also:
  QwtPlotZoomer, QwtPlotMagnifier

## Constructor & Destructor Documentation

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

Create a plot panner.

The panner is enabled for all axes

Parameters:

  canvas | Plot canvas to pan, also the parent object

See also:
  setAxisEnabled()

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

Destructor.

## Member Function Documentation

QwtPlotCanvas * QwtPlotPanner::canvas | ( |  | ) |

Return observed plot canvas.

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

Return Observed plot canvas.

const QCursor QwtPanner::cursor | ( |  | ) | const`[inherited]`

Returns:
  Cursor that is active while panning

See also:
  setCursor()

bool QwtPanner::eventFilter | ( | QObject * | o,
|  | QEvent * | e
| ) |  | `[virtual, inherited]`

Event filter.

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

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

void QwtPanner::getAbortKey | ( | int & | key,
|  | int & | state
| ) |  | const`[inherited]`

Get the abort key.

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

Get the mouse button.

bool QwtPlotPanner::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(), moveCanvas()

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

Returns:
  true when enabled, false otherwise

See also:
  setEnabled, eventFilter()

bool QwtPanner::isOrientationEnabled | ( | Qt::Orientation | o | ) | const`[inherited]`

Return true if a orientatio is enabled

See also:
  orientations(), setOrientations()

void QwtPlotPanner::moveCanvas | ( | int | dx,
|  | int | dy
| ) |  | `[protected, virtual, slot]`

Adjust the enabled axes according to dx/dy

Parameters:

  dx | Pixel offset in x direction
  dy | Pixel offset in y direction

See also:
  QwtPanner::panned()

void QwtPanner::moved | ( | int | dx,
|  | int | dy
| ) |  | `[signal, inherited]`

Signal emitted, while the widget moved, but panning is not finished.

Parameters:

  dx | Offset in horizontal direction
  dy | Offset in vertical direction

Qt::Orientations QwtPanner::orientations | ( |  | ) | const`[inherited]`

Return the orientation, where paning is enabled.

void QwtPanner::paintEvent | ( | QPaintEvent * | pe | ) | `[protected, virtual, inherited]`

Paint event.

Repaint the grabbed pixmap on its current position and fill the empty spaces by the background of the parent widget.

Parameters:

  pe | Paint event

void QwtPanner::panned | ( | int | dx,
|  | int | dy
| ) |  | `[signal, inherited]`

Signal emitted, when panning is done

Parameters:

  dx | Offset in horizontal direction
  dy | Offset in vertical direction

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

Return plot widget, containing the observed plot canvas.

QwtPlot * QwtPlotPanner::plot | ( |  | ) |

Return plot widget, containing the observed plot canvas.

void QwtPanner::setAbortKey | ( | int | key,
|  | int | state = `Qt::NoButton`
| ) |  | `[inherited]`

Change the abort key The defaults are Qt::Key_Escape and Qt::NoButton

Parameters:

  key | Key ( See Qt::Keycode )
  state | State

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

En/Disable an axis.

Axes that are enabled will be synchronized to the result of panning. All other axes will remain unchanged.

Parameters:

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

See also:
  isAxisEnabled(), moveCanvas()

void QwtPanner::setCursor | ( | const QCursor & | cursor | ) | `[inherited]`

Change the cursor, that is active while panning The default is the cursor of the parent widget.

Parameters:

  cursor | New cursor

See also:
  setCursor()

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

En/disable the panner.

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 QwtPanner::setMouseButton | ( | int | button,
|  | int | buttonState = `Qt::NoButton`
| ) |  | `[inherited]`

Change the mouse button The defaults are Qt::LeftButton and Qt::NoButton

void QwtPanner::setOrientations | ( | Qt::Orientations | o | ) | `[inherited]`

Set the orientations, where panning is enabled The default value is in both directions: Qt::Horizontal | Qt::Vertical

/param o Orientation

void QwtPanner::widgetKeyPressEvent | ( | QKeyEvent * | ke | ) | `[protected, virtual, inherited]`

Handle a key press event for the observed widget.

Parameters:

  ke | Key event

See also:
  eventFilter(), widgetKeyReleaseEvent()

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

Handle a key release event for the observed widget.

See also:
  eventFilter(), widgetKeyReleaseEvent()

void QwtPanner::widgetMouseMoveEvent | ( | QMouseEvent * | me | ) | `[protected, virtual, inherited]`

Handle a mouse move event for the observed widget.

Parameters:

  me | Mouse event

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

void QwtPanner::widgetMousePressEvent | ( | QMouseEvent * | me | ) | `[protected, virtual, inherited]`

Handle a mouse press event for the observed widget.

Parameters:

  me | Mouse event

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

void QwtPanner::widgetMouseReleaseEvent | ( | QMouseEvent * | me | ) | `[protected, virtual, inherited]`

Handle a mouse release event for the observed widget.

Parameters:

  me | Mouse event

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