Qwt Programmer's manual

QwtSliderBase


NAME

QwtSliderBase - A Base class for sliders

SYNOPSIS

#include <qwt_sldbase.h>

INHERITED CLASSES

QWidget, QwtDblRange

PUBLIC MEMBERS

QwtSliderBase
constructor
QwtSliderBase
destructor
stopMoving
stop moving
setTracking
enable or disable tracking

SIGNALS

valueChanged
Emitted when the value has been changed
sliderPressed
Emitted when the button has been pressed QwtSliderbase::sliderReleased() - Emitted when the button has been released
sliderMoved
Emitted when the button has been moved

PUBLIC SLOTS

setValue
move to value
fitValue
move to nearest integer multiple of the step size

PROTECTED MEMBERS

setUpdateTime
Change the update time for automatic scrolling
setMass
set the mass for flywheel effect
setPosition
adjust the position
valueChange
notify change of value
mass
return the mass
getValue
Determine the value corresponding to a point p
getScrollMode
Determine the scrolling mode corresponding to a point p

DESCRIPTION

QwtSliderBase is a base class for slider widgets. QwtSliderBase handles the 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 FUNCTION DESCRIPTION


QwtSliderBase::QwtSliderBase

Constructor

Syntax

QwtSliderBase::QwtSliderBase(QWidget *parent, const char *name)

Parameters

QWidget *parent, const char *name

QwtSliderBase::~QwtSliderBase

Destructor

Syntax

QwtSliderBase::~QwtSliderBase()

QwtSliderBase::stopMoving

Stop updating if automatic scrolling is active

Syntax

void QwtSliderBase::stopMoving()

QwtSliderBase::setUpdateTime

Specify the update interval for automatic scrolling

Syntax

void QwtSliderBase::setUpdateTime(int t)

Parameters

int t
update interval in milliseconds

See also

getScrollMode

QwtSliderBase::mouseReleaseEvent

Mouse Release Event handler

Syntax

void QwtSliderBase::mouseReleaseEvent(QMouseEvent *e)

Parameters

QMouseEvent *e
Qt Mouse Event

QwtSliderBase::setPosition

Move the slider to a specified point, adjust the value and emit signals if necessary

Syntax

void QwtSliderBase::setPosition(const QPoint &p)

Parameters

const QPoint &p

QwtSliderBase::setTracking

Enables or disables tracking.

Syntax

void QwtSliderBase::setTracking(bool enable)

Parameters

bool enable
enable (TRUE) or disable (FALSE) tracking

Description

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

Tracking is enabled by default.


QwtSliderBase::timerEvent

Timer event handler

Syntax

void QwtSliderBase::timerEvent(QTimerEvent *e)

Parameters

QTimerEvent *e
Qt timer event

QwtSliderBase::valueChange

Notify change of value

Syntax

void QwtSliderBase::valueChange()

Parameters

double x
new value

Description

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.

QwtSliderBase::setMass

Set the slider's mass for flywheel effect.

Syntax

void QwtSliderBase::setMass(double val)

Parameters

double val
new mass in kg

Description

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. Limits: If the mass is smaller than 1g, it is set to zero. The maximal mass is limited to 100kg. Derived widgets may overload this function to make it public.

QwtSliderBase::setValue

Move the slider to a specified value

Syntax

void QwtSliderBase::setValue(double val)

Parameters

double val
new value

Description

This function can be used to move the slider to a value which is not an integer multiple of the step size.

See also

fitValue

QSlider::fitValue

Set the slider's value to the nearest integer multiple of the step size.

Syntax

void QwtSliderBase::fitValue(double val)

See also:

setValue

QwtSliderBase::incValue

Increment the value by a specified number of steps

Syntax

void QwtSliderBase::incValue(int steps)

Parameters

int steps
number of steps

QwtSliderBase::getValue

Determine the value corresponding to a specified poind

Syntax

void QwtSliderBase::getValue(const QPoint &p)

Parameters

const QPoint &p
point

Description

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.

QwtSliderBase::getScrollMode

Determine what to do when the user presses a mouse button.

Syntax

void QwtSliderBase::getScrollMode(const QPoint &p, int &scrollMode, int &direction)

Input Parameters

const QPoint &p
point where the mouse was pressed

Output parameters

int &scrollMode -- The scrolling mode int &direction -- direction: 1, 0, or -1.

Description

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. QwtSliderBase knows the following modes:
QwtSliderBase::ScrNone
Scrolling switched off. Don't change the value.
QwtSliderBase::ScrMouse
Change the value while the user keeps the button pressed and moves the mouse.
QwtSliderBase::ScrTimer
Automatic scrolling. Increment the value in the specified direction as long as the user keeps the button pressed.
QwtSliderBase::ScrPage
Automatic scrolling. Same as ScrTimer, but increment by page size.

QwtSliderBase::valueChanged

Notify a change of value.

Syntax

void QwtSliderBase::valueChanged(double value)

Parameters

double value
new value

Description

In the default setting (tracking enabled), this signal will be emitted every time the value changes ( see setTracking() ).

QwtSliderBase::sliderPressed

This signal is emitted when the user presses the movable part of the slider (start ScrMouse Mode).

Syntax

void QwtSliderBase::sliderPressed()

QwtSliderBase::SliderReleased

This signal is emitted when the user releases the movable part of the slider.

Syntax

void QwtSliderbase::SliderReleased()

QwtSliderBase::sliderMoved

This signal is emitted when the user moves the slider with the mouse.

Syntax

void QwtSliderBase::sliderMoved(double value)

Parameters

double value
new value

Qwt Widget Library 02/04/98