Home · Overviews · Examples 

QAbstractSlider Class Reference
[com.trolltech.qt.gui module]

The QAbstractSlider class provides an integer value within a range. More...

Inherits QWidget.

Inherited by QDial, QScrollBar, and QSlider.


Detailed Description

The QAbstractSlider class provides an integer value within a range.

The class is designed as a common super class for widgets like QScrollBar, QSlider and QDial.

Here are the main properties of the class:

  1. value: The bounded integer that QAbstractSlider maintains.
  2. minimum: The lowest possible value.
  3. maximum: The highest possible value.
  4. singleStep: The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.
  5. pageStep: The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.
  6. tracking: Whether slider tracking is enabled.
  7. sliderPosition: The current position of the slider. If tracking is enabled (the default), this is identical to value.

Unity (1) may be viewed as a third step size. setValue lets you set the current value to any integer in the allowed range, not just minimum + n * singleStep for integer values of n. Some widgets may allow the user to set any value at all; others may just provide multiples of singleStep or pageStep.

QAbstractSlider emits a comprehensive set of signals:

SignalEmitted when
valueChangedthe value has changed. The tracking determines whether this signal is emitted during user interaction.
sliderPressedthe user starts to drag the slider.
sliderMovedthe user drags the slider.
sliderReleasedthe user releases the slider.
actionTriggereda slider action was triggerd.
rangeChangeda the range has changed.

QAbstractSlider provides a virtual sliderChange function that is well suited for updating the on-screen representation of sliders. By calling triggerAction, subclasses trigger slider actions. Two helper functions QStyle::sliderPositionFromValue() and QStyle::sliderValueFromPosition() help subclasses and styles to map screen coordinates to logical range values.

See also QAbstractSpinBox, QSlider, QDial, QScrollBar, and Sliders Example.


Copyright © 2008 Trolltech Trademarks
Qt Jambi 4.3.4_01