The QAbstractSlider class provides an integer value within a range. 更多...
继承 QWidget .
Inherited by QDial , QScrollBar and QSlider .
The QAbstractSlider class provides an integer value within a range.
此类被设计作为 Widget 的通用超类像 QScrollBar , QSlider and QDial .
这里是类的主要特性:
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 () 或 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 QStyle.sliderPositionFromValue () and QStyle.sliderValueFromPosition () help subclasses and styles to map screen coordinates to logical range values.
| 常量 | 值 |
|---|---|
| QAbstractSlider.SliderNoAction | 0 |
| QAbstractSlider.SliderSingleStepAdd | 1 |
| QAbstractSlider.SliderSingleStepSub | 2 |
| QAbstractSlider.SliderPageStepAdd | 3 |
| QAbstractSlider.SliderPageStepSub | 4 |
| QAbstractSlider.SliderToMinimum | 5 |
| QAbstractSlider.SliderToMaximum | 6 |
| QAbstractSlider.SliderMove | 7 |
| 常量 | 值 |
|---|---|
| QAbstractSlider.SliderRangeChange | 0 |
| QAbstractSlider.SliderOrientationChange | 1 |
| QAbstractSlider.SliderStepsChange | 2 |
| QAbstractSlider.SliderValueChange | 3 |
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
构造抽象滑块。
parent 自变量被发送给 QWidget 构造函数。
minimum 默认为 0, maximum 到 99,采用 singleStep size of 1 and a pageStep size of 10, and an initial value of 0.
重实现自 QWidget.changeEvent ().
重实现自 QObject.event ().
重实现自 QWidget.keyPressEvent ().
返回当前的重复动作。
另请参阅 setRepeatAction ().
This method is also a Qt slot with the C++ signature void setOrientation(Qt::Orientation) .
Sets the slider's minimum to min and its maximum to max .
若 max 小于 min , min becomes the only legal value.
设置动作 action to be triggered repetitively in intervals of repeatTime , after an initial delay of thresholdTime .
另请参阅 triggerAction () 和 repeatAction ().
This method is also a Qt slot with the C++ signature void setValue(int) .
Reimplement this virtual function to track slider changes such as SliderRangeChange , SliderOrientationChange , SliderStepsChange ,或 SliderValueChange 。 default implementation only updates the display and ignores the change 参数。
重实现自 QObject.timerEvent ().
触发滑块 action 。可能的动作是 SliderSingleStepAdd , SliderSingleStepSub , SliderPageStepAdd , SliderPageStepSub , SliderToMinimum , SliderToMaximum ,和 SliderMove .
另请参阅 actionTriggered ().
重实现自 QWidget.wheelEvent ().
This is the default overload of this signal.
This signal is emitted when the slider action action is triggered. Actions are SliderSingleStepAdd , SliderSingleStepSub , SliderPageStepAdd , SliderPageStepSub , SliderToMinimum , SliderToMaximum ,和 SliderMove .
When the signal is emitted, the sliderPosition has been adjusted according to the action, but the value has not yet been propagated (meaning the valueChanged () signal was not yet emitted), and the visual display has not been updated. In slots connected to this signal you can thus safely adjust any action by calling setSliderPosition () yourself, based on both the action and the slider's value.
另请参阅 triggerAction ().
This is the default overload of this signal.
This signal is emitted when the slider range has changed, with min being the new minimum, and max being the new maximum.
This is the default overload of this signal.
此信号被发射当 sliderDown is true and the slider moves. This usually happens when the user is dragging the slider. The value is the new slider position.
This signal is emitted even when tracking is turned off.
另请参阅 setTracking (), valueChanged (), isSliderDown (), sliderPressed (),和 sliderReleased ().
This is the default overload of this signal.
This signal is emitted when the user presses the slider with the mouse, or programmatically when setSliderDown(true) is called.
另请参阅 sliderReleased (), sliderMoved (),和 isSliderDown ().
This is the default overload of this signal.
This signal is emitted when the user releases the slider with the mouse, or programmatically when setSliderDown(false) is called.
另请参阅 sliderPressed (), sliderMoved (),和 sliderDown .
This is the default overload of this signal.
This signal is emitted when the slider value has changed, with the new slider value 作为自变量。