Skip to content

QDoubleRangeSlider

A QRangeSlider for float values: its range, values, and steps are floats. See the QRangeSlider page for how range sliders work.

QDoubleRangeSlider QDoubleRangeSlider
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QApplication

from superqt import QDoubleRangeSlider

app = QApplication([])

slider = QDoubleRangeSlider(Qt.Orientation.Horizontal)
slider.setRange(0, 1)
slider.setValue((0.2, 0.8))
slider.show()

app.exec()

QDoubleRangeSlider

QDoubleRangeSlider(*args, **kwargs)

Subclass of QSlider

QDoubleRangeSlider inherits all of QSlider's methods, signals, and properties. Only those that superqt adds or changes are listed here.

Signals

  • valuesChanged(tuple): Emitted when the slider value has changed, with the new slider values
  • slidersMoved(tuple): Emitted when sliderDown is true and the slider moves. This usually happens when the user is dragging the slider. The value is the positions of all handles.
  • fvalueChanged(float)
  • fsliderMoved(float)
  • frangeChanged(float, float)

Properties

barColor

barColor = Property(
    QtGui.QBrush, _getBarColor, _setBarColor
)

The color of the bar between the first and last handle.

Methods

applyMacStylePatch

applyMacStylePatch() -> None

Apply a QSS patch to fix sliders on macos>=12 with QT < 6.

see FAQ for more details.

barIsRigid

barIsRigid() -> bool

Whether bar length is constant when dragging the bar.

If False, the bar can shorten when dragged beyond min/max. Default is True.

barIsVisible

barIsVisible() -> bool

Whether to show the bar between the first and last handle.

barMovesAllHandles

barMovesAllHandles() -> bool

Whether clicking on the bar moves all handles, or just the nearest.

hideBar

hideBar() -> None

Hide the bar between the first and last handle.

invertedAppearance

invertedAppearance() -> bool

maximum

maximum() -> float

minimum

minimum() -> float

pageStep

pageStep() -> float

setBarIsRigid

setBarIsRigid(val: bool = True) -> None

Whether bar length is constant when dragging the bar.

If False, the bar can shorten when dragged beyond min/max. Default is True.

setBarMovesAllHandles

setBarMovesAllHandles(val: bool = True) -> None

Whether clicking on the bar moves all handles, or just the nearest.

setBarVisible

setBarVisible(val: bool = True) -> None

Whether to show the bar between the first and last handle.

setInvertedAppearance

setInvertedAppearance(inverted: bool) -> None

setMaximum

setMaximum(max: float) -> None

setMinimum

setMinimum(min: float) -> None

setPageStep

setPageStep(step: float) -> None

setRange

setRange(min: float, max_: float) -> None

setSingleStep

setSingleStep(step: float) -> None

setSliderPosition

setSliderPosition(
    pos: float | Sequence[float],
    index: int | None = None,
    *,
    reversed: bool = False,
) -> None

Set current position of the handles with a sequence of integers.

Parameters:

  • pos (Union[float, Sequence[float]]) –

    The new position of the slider handle(s). If a sequence, it must have the same length as value(). If it is a scalar, index will be used to set the position of the handle at that index.

  • index (int | None, default: None ) –

    The index of the handle to set the position of. If None, the "pressedIndex" will be used.

  • reversed (bool, default: False ) –

    Order in which to set the positions. Can be useful when setting multiple positions, to avoid intermediate overlapping values.

setTickInterval

setTickInterval(ts: float) -> None

setValue

setValue(value: _T) -> None

showBar

showBar() -> None

Show the bar between the first and last handle.

singleStep

singleStep() -> float

sliderPosition

sliderPosition()

Get current value of the widget as a tuple of integers.

If tracking is enabled (the default) this will be identical to value().

tickInterval

tickInterval() -> float

triggerAction

triggerAction(action: SliderAction) -> None

value

value() -> tuple[_T, ...]

Get current value of the widget as a tuple of integers.