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.
QSlider has 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);
setPageStep() to set the steps; and
setMaximum() to define the range of the scroll bar.
QSlider provides 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
tickInterval() functions, respectively.
QSlider inherits a comprehensive set of signals:
Emitted when the slider’s value has changed. The tracking() determines whether this signal is emitted during user interaction.
Emitted when the user starts to drag the slider.
Emitted when the user drags the slider.
Emitted when the user releases the slider.
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 (mininum).
End moves to the end (maximum).
Constructs a vertical slider with the given
Constructs a slider with the given
orientation parameter determines whether the slider is horizontal or vertical; the valid values are
This enum specifies where the tick marks are to be drawn relative to the slider’s groove and the handle the user moves.
Do not draw any tick marks.
Draw tick marks on both sides of the groove.
Draw tick marks above the (horizontal) slider
Draw tick marks below the (horizontal) slider
Draw tick marks to the left of the (vertical) slider
Draw tick marks to the right of the (vertical) slider
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.