PySide6.QtWidgets.QSlider¶
- class QSlider¶
- The - QSliderwidget provides a vertical or horizontal slider. More…- Synopsis¶- Properties¶- tickIntervalᅟ- The interval between tickmarks
- tickPositionᅟ- The tickmark position for this slider
 - Methods¶- def - __init__()
- def - tickInterval()
- def - tickPosition()
 - Virtual methods¶- Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶  - The slider is the classic widget for controlling a bounded value. It lets the user move a slider handle along a horizontal or vertical groove and translates the handle’s position into an integer value within the legal range. - QSliderhas very few of its own functions; most of the functionality is in- QAbstractSlider. The most useful functions are- setValue()to set the slider directly to some value;- triggerAction()to simulate the effects of clicking (useful for shortcut keys);- setSingleStep(),- setPageStep()to set the steps; and- setMinimum()and- setMaximum()to define the range of the scroll bar.- QSliderprovides methods for controlling tickmarks. You can use- setTickPosition()to indicate where you want the tickmarks to be,- setTickInterval()to indicate how many of them you want. the currently set tick position and interval can be queried using the- tickPosition()and- tickInterval()functions, respectively.- QSliderinherits a comprehensive set of signals:- Signal - Description - valueChanged()- Emitted when the slider’s value has changed. The tracking() determines whether this signal is emitted during user interaction. - sliderPressed()- Emitted when the user starts to drag the slider. - sliderMoved()- Emitted when the user drags the slider. - sliderReleased()- Emitted when the user releases the slider. - QSlideronly provides integer ranges. Note that although- QSliderhandles very large numbers, it becomes difficult for users to use a slider accurately for very large ranges.- A slider accepts focus on Tab and provides both a mouse wheel and a keyboard interface. The keyboard interface is the following: - Left/Right move a horizontal slider by one single step. 
- Up/Down move a vertical slider by one single step. 
- PageUp moves up one page. 
- PageDown moves down one page. 
- Home moves to the start (minimum). 
- End moves to the end (maximum). 
 - See also - QScrollBar- QSpinBox- QDialSliders Example- class TickPosition¶
- This enum specifies where the tick marks are to be drawn relative to the slider’s groove and the handle the user moves. - Constant - Description - QSlider.NoTicks - Do not draw any tick marks. - QSlider.TicksBothSides - Draw tick marks on both sides of the groove. - QSlider.TicksAbove - Draw tick marks above the (horizontal) slider - QSlider.TicksBelow - Draw tick marks below the (horizontal) slider - QSlider.TicksLeft - Draw tick marks to the left of the (vertical) slider - QSlider.TicksRight - Draw tick marks to the right of the (vertical) slider 
 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property tickIntervalᅟ: int¶
 - This property holds the interval between tickmarks. - This is a value interval, not a pixel interval. If it is 0, the slider will choose between singleStep and pageStep. - The default value is 0. - See also - Access functions:
 - property tickPositionᅟ: QSlider.TickPosition¶
 - This property holds the tickmark position for this slider. - The valid values are described by the - TickPositionenum.- The default value is - NoTicks.- See also - Access functions:
 - Constructs a vertical slider with the given - parent.- __init__(orientation[, parent=None])
- Parameters:
- orientation – - Orientation
- parent – - QWidget
 
 
 - Constructs a slider with the given - parent. The- orientationparameter determines whether the slider is horizontal or vertical; the valid values are Qt::Vertical and Qt::Horizontal.- initStyleOption(option)¶
- Parameters:
- option – - QStyleOptionSlider
 
 - Initialize - optionwith the values from this- QSlider. This method is useful for subclasses when they need a- QStyleOptionSlider, but don’t want to fill in all the information themselves.- See also - setTickInterval(ti)¶
- Parameters:
- ti – int 
 - See also 
 - Setter of property - tickIntervalᅟ.- setTickPosition(position)¶
- Parameters:
- position – - TickPosition
 - See also 
 - Setter of property - tickPositionᅟ.- tickInterval()¶
- Return type:
- int 
 - See also 
 - Getter of property - tickIntervalᅟ.- tickPosition()¶
- Return type:
 - See also 
 - Getter of property - tickPositionᅟ.