QSlider ClassThe QSlider widget provides a vertical or horizontal slider. More... #include <QSlider> Inherits: QAbstractSlider. Inherited by: Public Types
Properties
Public Functions
Reimplemented Public Functions
Protected Functions
Reimplemented Protected Functions
Additional Inherited Members
Detailed DescriptionThe QSlider widget provides a vertical or horizontal slider. 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); setSingleStep(), setPageStep() to set the steps; and setMinimum() 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 tickPosition() and tickInterval() functions, respectively. QSlider inherits a comprehensive set of signals:
QSlider only provides integer ranges. Note that although QSlider handles 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:
See also QScrollBar, QSpinBox, QDial, GUI Design Handbook: Slider, and Sliders Example. Member Type Documentation
|
Constant | Value | Description |
---|---|---|
QSlider::NoTicks | 0 | Do not draw any tick marks. |
QSlider::TicksBothSides | 3 | Draw tick marks on both sides of the groove. |
QSlider::TicksAbove | 1 | Draw tick marks above the (horizontal) slider |
QSlider::TicksBelow | 2 | Draw tick marks below the (horizontal) slider |
QSlider::TicksLeft | TicksAbove | Draw tick marks to the left of the (vertical) slider |
QSlider::TicksRight | TicksBelow | Draw tick marks to the right of the (vertical) slider |
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.
Access functions:
int | tickInterval() const |
void | setTickInterval(int ti) |
See also tickPosition, lineStep(), and pageStep().
This property holds the tickmark position for this slider.
The valid values are described by the QSlider::TickPosition enum.
The default value is QSlider::NoTicks.
Access functions:
TickPosition | tickPosition() const |
void | setTickPosition(TickPosition position) |
See also tickInterval.
Constructs a vertical slider with the given parent.
Constructs a slider with the given parent. The orientation parameter determines whether the slider is horizontal or vertical; the valid values are Qt::Vertical and Qt::Horizontal.
Destroys this slider.
Reimplemented from QObject::event().
Initialize option with 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 QStyleOption::initFrom().
Reimplemented from QWidget::minimumSizeHint().
Reimplemented from QWidget::mouseMoveEvent().
Reimplemented from QWidget::mousePressEvent().
Reimplemented from QWidget::mouseReleaseEvent().
Reimplemented from QWidget::paintEvent().
Reimplemented from QWidget::sizeHint().