#include <qwt_abstract_slider.h>
List of all members.
Public Types |
enum | ScrollMode {
ScrNone,
ScrMouse,
ScrTimer,
ScrDirect,
ScrPage
} |
Detailed Description
An abstract base class for slider widgets.
QwtAbstractSlider is a base class for slider widgets. It handles mouse events and updates the slider's value accordingly. Derived classes only have to implement the getValue() and getScrollMode() members, and should react to a valueChange(), which normally requires repainting.
Member Enumeration Documentation
Constructor & Destructor Documentation
QwtAbstractSlider::QwtAbstractSlider |
( |
Qt::Orientation |
orientation, |
|
|
QWidget * |
parent = NULL |
|
) |
| |
|
explicit |
Constructor.
- Parameters:
-
orientation | Orientation |
parent | Parent widget |
Member Function Documentation
void QwtAbstractSlider::fitValue |
( |
double |
value | ) |
|
|
virtualslot |
virtual void QwtAbstractSlider::getScrollMode |
( |
const QPoint & |
p, |
|
|
int & |
scrollMode, |
|
|
int & |
direction |
|
) |
| |
|
protectedpure virtual |
Determine what to do when the user presses a mouse button.
This function is abstract and has to be implemented by derived classes. It is called on a mousePress event. The derived class can determine what should happen next in dependence of the position where the mouse was pressed by returning scrolling mode and direction. QwtAbstractSlider knows the following modes:
- QwtAbstractSlider::ScrNone
- Scrolling switched off. Don't change the value.
- QwtAbstractSlider::ScrMouse
- Change the value while the user keeps the button pressed and moves the mouse.
- QwtAbstractSlider::ScrTimer
- Automatic scrolling. Increment the value in the specified direction as long as the user keeps the button pressed.
- QwtAbstractSlider::ScrPage
- Automatic scrolling. Same as ScrTimer, but increment by page size.
- Parameters:
-
p | point where the mouse was pressed |
- Return values:
-
scrollMode | The scrolling mode |
direction | direction: 1, 0, or -1. |
Implemented in QwtDial, QwtSlider, and QwtWheel.
virtual double QwtAbstractSlider::getValue |
( |
const QPoint & |
p | ) |
|
|
protectedpure virtual |
Determine the value corresponding to a specified poind.
This is an abstract virtual function which is called when the user presses or releases a mouse button or moves the mouse. It has to be implemented by the derived class.
- Parameters:
-
Implemented in QwtDial, QwtSlider, and QwtWheel.
void QwtAbstractSlider::incValue |
( |
int |
steps | ) |
|
|
virtualslot |
bool QwtAbstractSlider::isReadOnly |
( |
| ) |
const |
In read only mode the slider can't be controlled by mouse or keyboard.
- Returns:
- true if read only
- See also:
- setReadOnly()
bool QwtAbstractSlider::isValid |
( |
| ) |
const |
|
inline |
void QwtAbstractSlider::keyPressEvent |
( |
QKeyEvent * |
e | ) |
|
|
protectedvirtual |
Handles key events
- Key_Down, KeyLeft
Decrement by 1
- Key_Up, Key_Right
Increment by 1
- Parameters:
-
- See also:
- isReadOnly()
Reimplemented in QwtDial, and QwtCompass.
double QwtAbstractSlider::mass |
( |
| ) |
const |
|
virtual |
void QwtAbstractSlider::mouseMoveEvent |
( |
QMouseEvent * |
e | ) |
|
|
protectedvirtual |
Mouse Move Event handler
- Parameters:
-
void QwtAbstractSlider::mousePressEvent |
( |
QMouseEvent * |
e | ) |
|
|
protectedvirtual |
Mouse press event handler
- Parameters:
-
void QwtAbstractSlider::mouseReleaseEvent |
( |
QMouseEvent * |
e | ) |
|
|
protectedvirtual |
Mouse Release Event handler
- Parameters:
-
Qt::Orientation QwtAbstractSlider::orientation |
( |
| ) |
const |
void QwtAbstractSlider::setMass |
( |
double |
val | ) |
|
|
virtual |
Set the slider's mass for flywheel effect.
If the slider's mass is greater then 0, it will continue to move after the mouse button has been released. Its speed decreases with time at a rate depending on the slider's mass. A large mass means that it will continue to move for a long time.
Derived widgets may overload this function to make it public.
- Parameters:
-
- See also:
- mass()
Reimplemented in QwtWheel.
void QwtAbstractSlider::setOrientation |
( |
Qt::Orientation |
o | ) |
|
|
virtual |
Set the orientation.
- Parameters:
-
o | Orientation. Allowed values are Qt::Horizontal and Qt::Vertical. |
Reimplemented in QwtSlider, and QwtWheel.
void QwtAbstractSlider::setPosition |
( |
const QPoint & |
p | ) |
|
|
protectedvirtual |
Move the slider to a specified point, adjust the value and emit signals if necessary.
void QwtAbstractSlider::setReadOnly |
( |
bool |
readOnly | ) |
|
|
virtualslot |
En/Disable read only mode
In read only mode the slider can't be controlled by mouse or keyboard.
- Parameters:
-
readOnly | Enables in case of true |
- See also:
- isReadOnly()
void QwtAbstractSlider::setTracking |
( |
bool |
enable | ) |
|
Enables or disables tracking.
If tracking is enabled, the slider emits a valueChanged() signal whenever its value changes (the default behaviour). If tracking is disabled, the value changed() signal will only be emitted if:
-
the user releases the mouse button and the value has changed or
-
at the end of automatic scrolling.
Tracking is enabled by default.
- Parameters:
-
enable | true (enable) or false (disable) tracking. |
void QwtAbstractSlider::setUpdateTime |
( |
int |
t | ) |
|
Specify the update interval for automatic scrolling.
- Parameters:
-
t | update interval in milliseconds |
- See also:
- getScrollMode()
void QwtAbstractSlider::setValid |
( |
bool |
valid | ) |
|
|
inline |
- Parameters:
-
- See also:
- QwtDblRange::isValid()
Reimplemented from QwtDoubleRange.
void QwtAbstractSlider::setValue |
( |
double |
val | ) |
|
|
virtualslot |
Move the slider to a specified value.
This function can be used to move the slider to a value which is not an integer multiple of the step size.
- Parameters:
-
- See also:
- fitValue()
Reimplemented from QwtDoubleRange.
void QwtAbstractSlider::sliderMoved |
( |
double |
value | ) |
|
|
signal |
This signal is emitted when the user moves the slider with the mouse.
- Parameters:
-
void QwtAbstractSlider::sliderPressed |
( |
| ) |
|
|
signal |
This signal is emitted when the user presses the movable part of the slider (start ScrMouse Mode).
void QwtAbstractSlider::sliderReleased |
( |
| ) |
|
|
signal |
This signal is emitted when the user releases the movable part of the slider.
void QwtAbstractSlider::timerEvent |
( |
QTimerEvent * |
e | ) |
|
|
protectedvirtual |
Qt timer event
- Parameters:
-
void QwtAbstractSlider::valueChange |
( |
| ) |
|
|
protectedvirtual |
Notify change of value
This function can be reimplemented by derived classes in order to keep track of changes, i.e. repaint the widget. The default implementation emits a valueChanged() signal if tracking is enabled.
Reimplemented from QwtDoubleRange.
Reimplemented in QwtDial, QwtSlider, and QwtWheel.
void QwtAbstractSlider::valueChanged |
( |
double |
value | ) |
|
|
signal |
Notify a change of value.
In the default setting (tracking enabled), this signal will be emitted every time the value changes ( see setTracking() ).
- Parameters:
-
void QwtAbstractSlider::wheelEvent |
( |
QWheelEvent * |
e | ) |
|
|
protectedvirtual |
Wheel Event handler
- Parameters:
-