Using QwtMagnifier a plot can be zoomed in/out in steps using keys, the mouse wheel or moving a mouse button in vertical direction.
Definition at line 27 of file qwt_magnifier.h.
Public Member Functions | |
QwtMagnifier (QWidget *) | |
virtual | ~QwtMagnifier () |
QWidget * | parentWidget () |
const QWidget * | parentWidget () const |
void | setEnabled (bool) |
bool | isEnabled () const |
void | setMouseFactor (double) |
double | mouseFactor () const |
void | setMouseButton (int button, int buttonState=Qt::NoButton) |
void | getMouseButton (int &button, int &buttonState) const |
void | setWheelFactor (double) |
double | wheelFactor () const |
void | setWheelButtonState (int buttonState) |
int | wheelButtonState () const |
void | setKeyFactor (double) |
double | keyFactor () const |
void | setZoomInKey (int key, int modifiers) |
void | getZoomInKey (int &key, int &modifiers) const |
void | setZoomOutKey (int key, int modifiers) |
void | getZoomOutKey (int &key, int &modifiers) const |
virtual bool | eventFilter (QObject *, QEvent *) |
Protected Member Functions | |
virtual void | rescale (double factor)=0 |
virtual void | widgetMousePressEvent (QMouseEvent *) |
virtual void | widgetMouseReleaseEvent (QMouseEvent *) |
virtual void | widgetMouseMoveEvent (QMouseEvent *) |
virtual void | widgetWheelEvent (QWheelEvent *) |
virtual void | widgetKeyPressEvent (QKeyEvent *) |
virtual void | widgetKeyReleaseEvent (QKeyEvent *) |
QwtMagnifier::QwtMagnifier | ( | QWidget * | parent | ) | [explicit] |
Constructor
parent | Widget to be magnified |
Definition at line 66 of file qwt_magnifier.cpp.
References setEnabled().
QwtMagnifier::~QwtMagnifier | ( | ) | [virtual] |
void QwtMagnifier::setEnabled | ( | bool | on | ) |
En/disable the magnifier.
When enabled is true an event filter is installed for the observed widget, otherwise the event filter is removed.
on | true or false |
Definition at line 88 of file qwt_magnifier.cpp.
Referenced by QwtMagnifier().
bool QwtMagnifier::isEnabled | ( | ) | const |
Definition at line 109 of file qwt_magnifier.cpp.
void QwtMagnifier::setMouseFactor | ( | double | factor | ) |
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.
factor | Wheel factor |
Definition at line 170 of file qwt_magnifier.cpp.
double QwtMagnifier::mouseFactor | ( | ) | const |
void QwtMagnifier::setMouseButton | ( | int | button, | |
int | buttonState = Qt::NoButton | |||
) |
Assign the mouse button, that is used for zooming in/out. The default value is Qt::RightButton.
button | Button | |
buttonState | Button state |
Definition at line 192 of file qwt_magnifier.cpp.
void QwtMagnifier::getMouseButton | ( | int & | button, | |
int & | buttonState | |||
) | const |
void QwtMagnifier::setWheelFactor | ( | double | factor | ) |
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.
factor | Wheel factor |
Definition at line 125 of file qwt_magnifier.cpp.
double QwtMagnifier::wheelFactor | ( | ) | const |
void QwtMagnifier::setWheelButtonState | ( | int | buttonState | ) |
Assign a mandatory button state for zooming in/out using the wheel. The default button state is Qt::NoButton.
buttonState | Button state |
Definition at line 146 of file qwt_magnifier.cpp.
int QwtMagnifier::wheelButtonState | ( | ) | const |
Definition at line 155 of file qwt_magnifier.cpp.
void QwtMagnifier::setKeyFactor | ( | double | factor | ) |
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.
factor | Key factor |
Definition at line 217 of file qwt_magnifier.cpp.
double QwtMagnifier::keyFactor | ( | ) | const |
void QwtMagnifier::setZoomInKey | ( | int | key, | |
int | modifiers | |||
) |
Assign the key, that is used for zooming in. The default combination is Qt::Key_Plus + Qt::NoModifier.
key | ||
modifiers |
Definition at line 239 of file qwt_magnifier.cpp.
void QwtMagnifier::getZoomInKey | ( | int & | key, | |
int & | modifiers | |||
) | const |
void QwtMagnifier::setZoomOutKey | ( | int | key, | |
int | modifiers | |||
) |
Assign the key, that is used for zooming out. The default combination is Qt::Key_Minus + Qt::NoModifier.
key | ||
modifiers |
Definition at line 260 of file qwt_magnifier.cpp.
void QwtMagnifier::getZoomOutKey | ( | int & | key, | |
int & | modifiers | |||
) | const |
bool QwtMagnifier::eventFilter | ( | QObject * | o, | |
QEvent * | e | |||
) | [virtual] |
Event filter.
When isEnabled() the mouse events of the observed widget are filtered.
Definition at line 282 of file qwt_magnifier.cpp.
References widgetKeyPressEvent(), widgetKeyReleaseEvent(), widgetMouseMoveEvent(), widgetMousePressEvent(), widgetMouseReleaseEvent(), and widgetWheelEvent().
void QwtMagnifier::widgetMousePressEvent | ( | QMouseEvent * | me | ) | [protected, virtual] |
Handle a mouse press event for the observed widget.
me | Mouse event |
Definition at line 330 of file qwt_magnifier.cpp.
References parentWidget().
Referenced by eventFilter().
void QwtMagnifier::widgetMouseReleaseEvent | ( | QMouseEvent * | ) | [protected, virtual] |
Handle a mouse release event for the observed widget.
Definition at line 356 of file qwt_magnifier.cpp.
References parentWidget().
Referenced by eventFilter().
void QwtMagnifier::widgetMouseMoveEvent | ( | QMouseEvent * | me | ) | [protected, virtual] |
Handle a mouse move event for the observed widget.
me | Mouse event |
Definition at line 371 of file qwt_magnifier.cpp.
Referenced by eventFilter().
void QwtMagnifier::widgetWheelEvent | ( | QWheelEvent * | we | ) | [protected, virtual] |
Handle a wheel event for the observed widget.
we | Wheel event |
Definition at line 395 of file qwt_magnifier.cpp.
Referenced by eventFilter().
void QwtMagnifier::widgetKeyPressEvent | ( | QKeyEvent * | ke | ) | [protected, virtual] |
Handle a key press event for the observed widget.
ke | Key event |
Definition at line 434 of file qwt_magnifier.cpp.
Referenced by eventFilter().
void QwtMagnifier::widgetKeyReleaseEvent | ( | QKeyEvent * | ) | [protected, virtual] |
Handle a key release event for the observed widget.
ke | Key event |
Definition at line 461 of file qwt_magnifier.cpp.
Referenced by eventFilter().