QwtPanner Class Reference

Inheritance diagram for QwtPanner:

Inheritance graph
[legend]
List of all members.

Detailed Description

QwtPanner provides panning of a widget.

QwtPanner grabs the contents of a widget, that can be dragged in all directions. The offset between the start and the end position is emitted by the panned signal.

QwtPanner grabs the content of the widget into a pixmap and moves the pixmap around, without initiating any repaint events for the widget. Areas, that are not part of content are not painted while panning in in process. This makes panning fast enough for widgets, where repaints are too slow for mouse movements.

For widgets, where repaints are very fast it might be better to implement panning manually by mapping mouse events into paint events.

Definition at line 35 of file qwt_panner.h.

Signals

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

Public Member Functions

 QwtPanner (QWidget *parent)
virtual ~QwtPanner ()
void setEnabled (bool)
bool isEnabled () const
void setMouseButton (int button, int buttonState=Qt::NoButton)
void getMouseButton (int &button, int &buttonState) const
void setAbortKey (int key, int state=Qt::NoButton)
void getAbortKey (int &key, int &state) const
void setCursor (const QCursor &)
const QCursor cursor () const
virtual bool eventFilter (QObject *, QEvent *)

Protected Member Functions

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


Constructor & Destructor Documentation

QwtPanner::QwtPanner QWidget *  parent  ) 
 

Creates an panner that is enabled for the left mouse button.

Parameters:
parent Parent widget to be panned

Definition at line 64 of file qwt_panner.cpp.

References setEnabled().

QwtPanner::~QwtPanner  )  [virtual]
 

Destructor.

Definition at line 86 of file qwt_panner.cpp.


Member Function Documentation

const QCursor QwtPanner::cursor  )  const
 

Returns:
Cursor that is active while panning
See also:
setCursor()

Definition at line 145 of file qwt_panner.cpp.

bool QwtPanner::eventFilter QObject *  o,
QEvent *  e
[virtual]
 

Event filter.

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

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

Definition at line 246 of file qwt_panner.cpp.

References widgetMousePressEvent().

void QwtPanner::getAbortKey int &  key,
int &  state
const
 

Get the abort key.

Definition at line 119 of file qwt_panner.cpp.

void QwtPanner::getMouseButton int &  button,
int &  buttonState
const
 

Get the mouse button.

Definition at line 102 of file qwt_panner.cpp.

bool QwtPanner::isEnabled  )  const
 

Returns:
true when enabled, false otherwise
See also:
setEnabled, eventFilter()

Definition at line 192 of file qwt_panner.cpp.

void QwtPanner::moved int  dx,
int  dy
[signal]
 

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

Parameters:
dx Offset in horizontal direction
dy Offset in vertical direction

Referenced by widgetMouseMoveEvent().

void QwtPanner::paintEvent QPaintEvent *  pe  )  [protected, virtual]
 

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

Definition at line 205 of file qwt_panner.cpp.

void QwtPanner::panned int  dx,
int  dy
[signal]
 

Signal emitted, when panning is done

Parameters:
dx Offset in horizontal direction
dy Offset in vertical direction

Referenced by QwtPlotPanner::QwtPlotPanner(), and widgetMouseReleaseEvent().

void QwtPanner::setAbortKey int  key,
int  state = Qt::NoButton
 

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

Definition at line 112 of file qwt_panner.cpp.

void QwtPanner::setCursor const QCursor &  cursor  ) 
 

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

Parameters:
cursor New cursor
See also:
setCursor()

Definition at line 134 of file qwt_panner.cpp.

void QwtPanner::setEnabled bool  on  ) 
 

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

Definition at line 166 of file qwt_panner.cpp.

Referenced by QwtPanner().

void QwtPanner::setMouseButton int  button,
int  buttonState = Qt::NoButton
 

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

Definition at line 95 of file qwt_panner.cpp.

void QwtPanner::widgetKeyPressEvent QKeyEvent *  ke  )  [protected, virtual]
 

Handle a key press event for the observed widget.

Parameters:
ke Key event
See also:
eventFilter(), widgetKeyReleaseEvent()

Definition at line 379 of file qwt_panner.cpp.

void QwtPanner::widgetKeyReleaseEvent QKeyEvent *   )  [protected, virtual]
 

Handle a key release event for the observed widget.

Parameters:
ke Key event
See also:
eventFilter(), widgetKeyReleaseEvent()

Definition at line 408 of file qwt_panner.cpp.

void QwtPanner::widgetMouseMoveEvent QMouseEvent *  me  )  [protected, virtual]
 

Handle a mouse release event for the observed widget.

Parameters:
me Mouse event
See also:
eventFilter(), widgetMousePressEvent(), widgetMouseMoveEvent(),

Definition at line 336 of file qwt_panner.cpp.

References moved().

void QwtPanner::widgetMousePressEvent QMouseEvent *  me  )  [protected, virtual]
 

Handle a mouse press event for the observed widget.

Parameters:
me Mouse event
See also:
eventFilter(), widgetMouseReleaseEvent(), widgetMouseMoveEvent(),

Definition at line 291 of file qwt_panner.cpp.

Referenced by eventFilter().

void QwtPanner::widgetMouseReleaseEvent QMouseEvent *  me  )  [protected, virtual]
 

Handle a mouse move event for the observed widget.

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

Definition at line 353 of file qwt_panner.cpp.

References panned().


Generated on Mon Feb 26 21:24:21 2007 for Qwt User's Guide by  doxygen 1.4.6