Qwt User's Guide  6.1.0
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Member Functions | List of all members
QwtMagnifier Class Referenceabstract

QwtMagnifier provides zooming, by magnifying in steps. More...

#include <qwt_magnifier.h>

Inheritance diagram for QwtMagnifier:
Inheritance graph
[legend]

Public Member Functions

 QwtMagnifier (QWidget *)
 
virtual ~QwtMagnifier ()
 Destructor.
 
QWidget * parentWidget ()
 
const QWidget * parentWidget () const
 
void setEnabled (bool)
 En/disable the magnifier. More...
 
bool isEnabled () const
 
void setMouseFactor (double)
 Change the mouse factor. More...
 
double mouseFactor () const
 
void setMouseButton (Qt::MouseButton, Qt::KeyboardModifiers=Qt::NoModifier)
 
void getMouseButton (Qt::MouseButton &, Qt::KeyboardModifiers &) const
 
void setWheelFactor (double)
 Change the wheel factor. More...
 
double wheelFactor () const
 
void setWheelModifiers (Qt::KeyboardModifiers)
 
Qt::KeyboardModifiers wheelModifiers () const
 
void setKeyFactor (double)
 Change the key factor. More...
 
double keyFactor () const
 
void setZoomInKey (int key, Qt::KeyboardModifiers=Qt::NoModifier)
 
void getZoomInKey (int &key, Qt::KeyboardModifiers &) const
 Retrieve the settings of the zoom in key. More...
 
void setZoomOutKey (int key, Qt::KeyboardModifiers=Qt::NoModifier)
 
void getZoomOutKey (int &key, Qt::KeyboardModifiers &) const
 Retrieve the settings of the zoom out key. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Event filter. More...
 

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

Detailed Description

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.

Constructor & Destructor Documentation

QwtMagnifier::QwtMagnifier ( QWidget *  parent)
explicit

Constructor

Parameters
parentWidget to be magnified

Member Function Documentation

bool QwtMagnifier::eventFilter ( QObject *  object,
QEvent *  event 
)
virtual

Event filter.

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

Parameters
objectObject to be filtered
eventEvent
Returns
Forwarded to QObject::eventFilter()
See Also
widgetMousePressEvent(), widgetMouseReleaseEvent(), widgetMouseMoveEvent(), widgetWheelEvent(), widgetKeyPressEvent() widgetKeyReleaseEvent()
void QwtMagnifier::getMouseButton ( Qt::MouseButton &  button,
Qt::KeyboardModifiers &  modifiers 
) const
void QwtMagnifier::getZoomInKey ( int &  key,
Qt::KeyboardModifiers &  modifiers 
) const

Retrieve the settings of the zoom in key.

Parameters
keyKey code, see Qt::Key
modifiersKeyboard modifiers
See Also
setZoomInKey()
void QwtMagnifier::getZoomOutKey ( int &  key,
Qt::KeyboardModifiers &  modifiers 
) const

Retrieve the settings of the zoom out key.

Parameters
keyKey code, see Qt::Key
modifiersKeyboard modifiers
See Also
setZoomOutKey()
bool QwtMagnifier::isEnabled ( ) const
Returns
true when enabled, false otherwise
See Also
setEnabled(), eventFilter()
double QwtMagnifier::keyFactor ( ) const
Returns
Key factor
See Also
setKeyFactor()
double QwtMagnifier::mouseFactor ( ) const
Returns
Mouse factor
See Also
setMouseFactor()
QWidget * QwtMagnifier::parentWidget ( )
Returns
Parent widget, where the rescaling happens
const QWidget * QwtMagnifier::parentWidget ( ) const
Returns
Parent widget, where the rescaling happens
virtual void QwtMagnifier::rescale ( double  factor)
protectedpure virtual

Rescale the parent widget

Parameters
factorScale factor

Implemented in QwtPlotMagnifier.

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.

Parameters
ontrue or false
See Also
isEnabled(), eventFilter()
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.

Parameters
factorKey factor
See Also
keyFactor(), setZoomInKey(), setZoomOutKey(), setWheelFactor, setMouseFactor()
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.

Parameters
buttonButton
modifiersKeyboard modifiers
See Also
getMouseButton()
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.

Parameters
factorWheel factor
See Also
mouseFactor(), setMouseButton(), setWheelFactor(), setKeyFactor()
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.

Parameters
factorWheel factor
See Also
wheelFactor(), setWheelButtonState(), setMouseFactor(), setKeyFactor()
void QwtMagnifier::setWheelModifiers ( Qt::KeyboardModifiers  modifiers)

Assign keyboard modifiers for zooming in/out using the wheel. The default modifiers are Qt::NoModifiers.

Parameters
modifiersKeyboard modifiers
See Also
wheelModifiers()
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.

Parameters
key
modifiers
See Also
getZoomInKey(), setZoomOutKey()
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.

Parameters
key
modifiers
See Also
getZoomOutKey(), setZoomOutKey()
double QwtMagnifier::wheelFactor ( ) const
Returns
Wheel factor
See Also
setWheelFactor()
Qt::KeyboardModifiers QwtMagnifier::wheelModifiers ( ) const
Returns
Wheel modifiers
See Also
setWheelModifiers()
void QwtMagnifier::widgetKeyPressEvent ( QKeyEvent *  keyEvent)
protectedvirtual

Handle a key press event for the observed widget.

Parameters
keyEventKey event
See Also
eventFilter(), widgetKeyReleaseEvent()
void QwtMagnifier::widgetKeyReleaseEvent ( QKeyEvent *  keyEvent)
protectedvirtual

Handle a key release event for the observed widget.

Parameters
keyEventKey event
See Also
eventFilter(), widgetKeyReleaseEvent()
void QwtMagnifier::widgetMouseMoveEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

Handle a mouse move event for the observed widget.

Parameters
mouseEventMouse event
See Also
eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
void QwtMagnifier::widgetMousePressEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

Handle a mouse press event for the observed widget.

Parameters
mouseEventMouse event
See Also
eventFilter(), widgetMouseReleaseEvent(), widgetMouseMoveEvent()
void QwtMagnifier::widgetMouseReleaseEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

Handle a mouse release event for the observed widget.

Parameters
mouseEventMouse event
See Also
eventFilter(), widgetMousePressEvent(), widgetMouseMoveEvent(),
void QwtMagnifier::widgetWheelEvent ( QWheelEvent *  wheelEvent)
protectedvirtual

Handle a wheel event for the observed widget.

Parameters
wheelEventWheel event
See Also
eventFilter()