QwtMagnifier provides zooming, by magnifying in steps. More...
#include <qwt_magnifier.h>
Classes | |
class | PrivateData |
Public Member Functions | |
virtual bool | eventFilter (QObject *, QEvent *) |
Event filter. | |
void | getMouseButton (Qt::MouseButton &, Qt::KeyboardModifiers &) const |
void | getZoomInKey (int &key, Qt::KeyboardModifiers &) const |
Retrieve the settings of the zoom in key. | |
void | getZoomOutKey (int &key, Qt::KeyboardModifiers &) const |
Retrieve the settings of the zoom out key. | |
bool | isEnabled () const |
double | keyFactor () const |
double | mouseFactor () const |
QWidget * | parentWidget () |
const QWidget * | parentWidget () const |
QwtMagnifier (QWidget *) | |
void | setEnabled (bool) |
En/disable the magnifier. | |
void | setKeyFactor (double) |
Change the key factor. | |
void | setMouseButton (Qt::MouseButton, Qt::KeyboardModifiers=Qt::NoModifier) |
void | setMouseFactor (double) |
Change the mouse factor. | |
void | setWheelFactor (double) |
Change the wheel factor. | |
void | setWheelModifiers (Qt::KeyboardModifiers) |
void | setZoomInKey (int key, Qt::KeyboardModifiers=Qt::NoModifier) |
void | setZoomOutKey (int key, Qt::KeyboardModifiers=Qt::NoModifier) |
double | wheelFactor () const |
Qt::KeyboardModifiers | wheelModifiers () const |
virtual | ~QwtMagnifier () |
Destructor. | |
Protected Member Functions | |
virtual void | rescale (double factor)=0 |
virtual void | widgetKeyPressEvent (QKeyEvent *) |
virtual void | widgetKeyReleaseEvent (QKeyEvent *) |
virtual void | widgetMouseMoveEvent (QMouseEvent *) |
virtual void | widgetMousePressEvent (QMouseEvent *) |
virtual void | widgetMouseReleaseEvent (QMouseEvent *) |
virtual void | widgetWheelEvent (QWheelEvent *) |
Private Attributes | |
PrivateData * | d_data |
QwtMagnifier provides zooming, by magnifying in steps.
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.
QwtMagnifier::QwtMagnifier | ( | QWidget * | parent | ) | [explicit] |
Constructor
parent | Widget to be magnified |
Definition at line 62 of file qwt_magnifier.cpp.
QwtMagnifier::~QwtMagnifier | ( | ) | [virtual] |
Destructor.
Definition at line 77 of file qwt_magnifier.cpp.
bool QwtMagnifier::eventFilter | ( | QObject * | object, |
QEvent * | event | ||
) | [virtual] |
Event filter.
When isEnabled() is true, the mouse events of the observed widget are filtered.
object | Object to be filtered |
event | Event |
Definition at line 316 of file qwt_magnifier.cpp.
void QwtMagnifier::getMouseButton | ( | Qt::MouseButton & | button, |
Qt::KeyboardModifiers & | modifiers | ||
) | const |
Definition at line 209 of file qwt_magnifier.cpp.
void QwtMagnifier::getZoomInKey | ( | int & | key, |
Qt::KeyboardModifiers & | modifiers | ||
) | const |
Retrieve the settings of the zoom in key.
key | Key code, see Qt::Key |
modifiers | Keyboard modifiers |
Definition at line 264 of file qwt_magnifier.cpp.
void QwtMagnifier::getZoomOutKey | ( | int & | key, |
Qt::KeyboardModifiers & | modifiers | ||
) | const |
Retrieve the settings of the zoom out key.
key | Key code, see Qt::Key |
modifiers | Keyboard modifiers |
Definition at line 294 of file qwt_magnifier.cpp.
bool QwtMagnifier::isEnabled | ( | ) | const |
Definition at line 112 of file qwt_magnifier.cpp.
double QwtMagnifier::keyFactor | ( | ) | const |
double QwtMagnifier::mouseFactor | ( | ) | const |
QWidget * QwtMagnifier::parentWidget | ( | ) |
Definition at line 490 of file qwt_magnifier.cpp.
const QWidget * QwtMagnifier::parentWidget | ( | ) | const |
Definition at line 496 of file qwt_magnifier.cpp.
virtual void QwtMagnifier::rescale | ( | double | factor | ) | [protected, pure virtual] |
Rescale the parent widget
factor | Scale factor |
Implemented in QwtPlotMagnifier, and PlotMagnifier.
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 91 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 227 of file qwt_magnifier.cpp.
void QwtMagnifier::setMouseButton | ( | Qt::MouseButton | button, |
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) |
Assign the mouse button, that is used for zooming in/out. The default value is Qt::RightButton.
button | Button |
modifiers | Keyboard modifiers |
Definition at line 201 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 178 of file qwt_magnifier.cpp.
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.
Use values > 1 for magnification (i.e. 2.0) and values < 1 for scaling down (i.e. 1/2.0 = 0.5). You can use this feature for inverting the direction of the wheel.
The default value is 0.9.
factor | Wheel factor |
Definition at line 133 of file qwt_magnifier.cpp.
void QwtMagnifier::setWheelModifiers | ( | Qt::KeyboardModifiers | modifiers | ) |
Assign keyboard modifiers for zooming in/out using the wheel. The default modifiers are Qt::NoModifiers.
modifiers | Keyboard modifiers |
Definition at line 154 of file qwt_magnifier.cpp.
void QwtMagnifier::setZoomInKey | ( | int | key, |
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) |
Assign the key, that is used for zooming in. The default combination is Qt::Key_Plus + Qt::NoModifier.
key | |
modifiers |
Definition at line 249 of file qwt_magnifier.cpp.
void QwtMagnifier::setZoomOutKey | ( | int | key, |
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) |
Assign the key, that is used for zooming out. The default combination is Qt::Key_Minus + Qt::NoModifier.
key | |
modifiers |
Definition at line 279 of file qwt_magnifier.cpp.
double QwtMagnifier::wheelFactor | ( | ) | const |
Qt::KeyboardModifiers QwtMagnifier::wheelModifiers | ( | ) | const |
Definition at line 163 of file qwt_magnifier.cpp.
void QwtMagnifier::widgetKeyPressEvent | ( | QKeyEvent * | keyEvent | ) | [protected, virtual] |
Handle a key press event for the observed widget.
keyEvent | Key event |
Definition at line 464 of file qwt_magnifier.cpp.
void QwtMagnifier::widgetKeyReleaseEvent | ( | QKeyEvent * | keyEvent | ) | [protected, virtual] |
Handle a key release event for the observed widget.
keyEvent | Key event |
Definition at line 484 of file qwt_magnifier.cpp.
void QwtMagnifier::widgetMouseMoveEvent | ( | QMouseEvent * | mouseEvent | ) | [protected, virtual] |
Handle a mouse move event for the observed widget.
mouseEvent | Mouse event |
Definition at line 406 of file qwt_magnifier.cpp.
void QwtMagnifier::widgetMousePressEvent | ( | QMouseEvent * | mouseEvent | ) | [protected, virtual] |
Handle a mouse press event for the observed widget.
mouseEvent | Mouse event |
Reimplemented in PlotMagnifier.
Definition at line 364 of file qwt_magnifier.cpp.
void QwtMagnifier::widgetMouseReleaseEvent | ( | QMouseEvent * | mouseEvent | ) | [protected, virtual] |
Handle a mouse release event for the observed widget.
mouseEvent | Mouse event |
Definition at line 389 of file qwt_magnifier.cpp.
void QwtMagnifier::widgetWheelEvent | ( | QWheelEvent * | wheelEvent | ) | [protected, virtual] |
Handle a wheel event for the observed widget.
wheelEvent | Wheel event |
Reimplemented in PlotMagnifier.
Definition at line 430 of file qwt_magnifier.cpp.
PrivateData* QwtMagnifier::d_data [private] |
Reimplemented in QwtPlotMagnifier.
Definition at line 82 of file qwt_magnifier.h.