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 *) |
|
Creates an panner that is enabled for the left mouse button.
Definition at line 108 of file qwt_panner.cpp. References setEnabled(). |
|
Destructor.
Definition at line 127 of file qwt_panner.cpp. |
|
Definition at line 186 of file qwt_panner.cpp. |
|
Event filter. When isEnabled() the mouse events of the observed widget are filtered.
Definition at line 287 of file qwt_panner.cpp. References widgetMousePressEvent(). |
|
Get the abort key.
Definition at line 160 of file qwt_panner.cpp. |
|
Get the mouse button.
Definition at line 143 of file qwt_panner.cpp. |
|
Definition at line 233 of file qwt_panner.cpp. |
|
Signal emitted, while the widget moved, but panning is not finished.
Referenced by widgetMouseMoveEvent(). |
|
Paint event. Repaint the grabbed pixmap on its current position and fill the empty spaces by the background of the parent widget.
Definition at line 246 of file qwt_panner.cpp. |
|
Signal emitted, when panning is done
Referenced by QwtPlotPanner::QwtPlotPanner(), and widgetMouseReleaseEvent(). |
|
Change the abort key The defaults are Qt::Key_Escape and Qt::NoButton Definition at line 153 of file qwt_panner.cpp. |
|
Change the cursor, that is active while panning The default is the cursor of the parent widget.
Definition at line 175 of file qwt_panner.cpp. |
|
En/disable the panner. When enabled is true an event filter is installed for the observed widget, otherwise the event filter is removed.
Definition at line 207 of file qwt_panner.cpp. Referenced by QwtPanner(), and widgetMousePressEvent(). |
|
Change the mouse button The defaults are Qt::LeftButton and Qt::NoButton Definition at line 136 of file qwt_panner.cpp. |
|
Handle a key press event for the observed widget.
Definition at line 430 of file qwt_panner.cpp. |
|
Handle a key release event for the observed widget.
Definition at line 459 of file qwt_panner.cpp. |
|
Handle a mouse release event for the observed widget.
Definition at line 387 of file qwt_panner.cpp. References moved(). |
|
Handle a mouse press event for the observed widget.
Definition at line 332 of file qwt_panner.cpp. References setEnabled(). Referenced by eventFilter(). |
|
Handle a mouse move event for the observed widget.
Definition at line 404 of file qwt_panner.cpp. References panned(). |