QAbstractSlider

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

Inheritance diagram of PySide2.QtWidgets.QAbstractSlider

Inherited by: QDial, QScrollBar, QSlider

Synopsis

Functions

Virtual functions

Slots

Signals

Detailed Description

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:

Signal

Emitted when

valueChanged()

the value has changed. The tracking determines whether this signal is emitted during user interaction.

sliderPressed()

the user starts to drag the slider.

sliderMoved()

the user drags the slider.

sliderReleased()

the user releases the slider.

actionTriggered()

a slider action was triggerd.

rangeChanged()

a 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 sliderPositionFromValue() and sliderValueFromPosition() help subclasses and styles to map screen coordinates to logical range values.

See also

QAbstractSpinBox QSlider QDial QScrollBar Sliders Example

class QAbstractSlider([parent=None])
param parent

QWidget

Constructs an abstract slider.

The parent argument is sent to the QWidget constructor.

The minimum defaults to 0, the maximum to 99, with a singleStep size of 1 and a pageStep size of 10, and an initial value of 0.

PySide2.QtWidgets.QAbstractSlider.SliderAction

Constant

Description

QAbstractSlider.SliderNoAction

QAbstractSlider.SliderSingleStepAdd

QAbstractSlider.SliderSingleStepSub

QAbstractSlider.SliderPageStepAdd

QAbstractSlider.SliderPageStepSub

QAbstractSlider.SliderToMinimum

QAbstractSlider.SliderToMaximum

QAbstractSlider.SliderMove

PySide2.QtWidgets.QAbstractSlider.SliderChange

Constant

Description

QAbstractSlider.SliderRangeChange

QAbstractSlider.SliderOrientationChange

QAbstractSlider.SliderStepsChange

QAbstractSlider.SliderValueChange

PySide2.QtWidgets.QAbstractSlider.actionTriggered(action)
Parameters

actionint

PySide2.QtWidgets.QAbstractSlider.hasTracking()
Return type

bool

PySide2.QtWidgets.QAbstractSlider.invertedAppearance()
Return type

bool

PySide2.QtWidgets.QAbstractSlider.invertedControls()
Return type

bool

PySide2.QtWidgets.QAbstractSlider.isSliderDown()
Return type

bool

PySide2.QtWidgets.QAbstractSlider.maximum()
Return type

int

See also

setMaximum()

PySide2.QtWidgets.QAbstractSlider.minimum()
Return type

int

See also

setMinimum()

PySide2.QtWidgets.QAbstractSlider.orientation()
Return type

Orientation

See also

setOrientation()

PySide2.QtWidgets.QAbstractSlider.pageStep()
Return type

int

See also

setPageStep()

PySide2.QtWidgets.QAbstractSlider.rangeChanged(min, max)
Parameters
  • minint

  • maxint

PySide2.QtWidgets.QAbstractSlider.repeatAction()
Return type

SliderAction

Returns the current repeat action.

PySide2.QtWidgets.QAbstractSlider.setInvertedAppearance(arg__1)
Parameters

arg__1bool

PySide2.QtWidgets.QAbstractSlider.setInvertedControls(arg__1)
Parameters

arg__1bool

PySide2.QtWidgets.QAbstractSlider.setMaximum(arg__1)
Parameters

arg__1int

See also

maximum()

PySide2.QtWidgets.QAbstractSlider.setMinimum(arg__1)
Parameters

arg__1int

See also

minimum()

PySide2.QtWidgets.QAbstractSlider.setOrientation(arg__1)
Parameters

arg__1Orientation

See also

orientation()

PySide2.QtWidgets.QAbstractSlider.setPageStep(arg__1)
Parameters

arg__1int

See also

pageStep()

PySide2.QtWidgets.QAbstractSlider.setRange(min, max)
Parameters
  • minint

  • maxint

Sets the slider’s minimum to min and its maximum to max .

If max is smaller than min , min becomes the only legal value.

See also

minimum maximum

PySide2.QtWidgets.QAbstractSlider.setRepeatAction(action[, thresholdTime=500[, repeatTime=50]])
Parameters
  • actionSliderAction

  • thresholdTimeint

  • repeatTimeint

Sets action action to be triggered repetitively in intervals of repeatTime , after an initial delay of thresholdTime .

PySide2.QtWidgets.QAbstractSlider.setSingleStep(arg__1)
Parameters

arg__1int

See also

singleStep()

PySide2.QtWidgets.QAbstractSlider.setSliderDown(arg__1)
Parameters

arg__1bool

See also

isSliderDown()

PySide2.QtWidgets.QAbstractSlider.setSliderPosition(arg__1)
Parameters

arg__1int

See also

sliderPosition()

PySide2.QtWidgets.QAbstractSlider.setTracking(enable)
Parameters

enablebool

See also

hasTracking()

PySide2.QtWidgets.QAbstractSlider.setValue(arg__1)
Parameters

arg__1int

See also

value()

PySide2.QtWidgets.QAbstractSlider.singleStep()
Return type

int

See also

setSingleStep()

PySide2.QtWidgets.QAbstractSlider.sliderChange(change)
Parameters

changeSliderChange

Reimplement this virtual function to track slider changes such as SliderRangeChange , SliderOrientationChange , SliderStepsChange , or SliderValueChange . The default implementation only updates the display and ignores the change parameter.

PySide2.QtWidgets.QAbstractSlider.sliderMoved(position)
Parameters

positionint

PySide2.QtWidgets.QAbstractSlider.sliderPosition()
Return type

int

PySide2.QtWidgets.QAbstractSlider.sliderPressed()
PySide2.QtWidgets.QAbstractSlider.sliderReleased()
PySide2.QtWidgets.QAbstractSlider.triggerAction(action)
Parameters

actionSliderAction

Triggers a slider action . Possible actions are SliderSingleStepAdd , SliderSingleStepSub , SliderPageStepAdd , SliderPageStepSub , SliderToMinimum , SliderToMaximum , and SliderMove .

PySide2.QtWidgets.QAbstractSlider.value()
Return type

int

See also

setValue()

PySide2.QtWidgets.QAbstractSlider.valueChanged(value)
Parameters

valueint