def
initStyleOption
(option)
def
setTickInterval
(ti)
def
setTickPosition
(position)
def
tickInterval
()
def
tickPosition
()
![]()
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 inQAbstractSlider。最有用的功能是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; andsetMinimum()andsetMaximum()to define the range of the scroll bar.
QSliderprovides methods for controlling tickmarks. You can usesetTickPosition()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 thetickPosition()andtickInterval()functions, respectively.
QSliderinherits a comprehensive set of signals:
信号
描述
Emitted when the slider’s value has changed. The tracking() determines whether this signal is emitted during user interaction.
发射当用户开始拖曳滑块时。
发射当用户拖曳滑块时。
发射当用户释放滑块时。
QSlideronly provides integer ranges. Note that althoughQSliderhandles very large numbers, it becomes difficult for users to use a slider accurately for very large ranges.滑块接受 Tab 聚焦,并提供鼠标滚轮及键盘接口。键盘接口如下:
左/右箭头水平移动滑块一单步幅。
上/下箭头垂直移动滑块一单步幅。
PageUp 键上移一页。
PageDown 键下移一页。
Home 键移至开头 (最小)。
End 键移至结束 (最大)。
QSlider
(
[
parent=None
]
)
¶
QSlider(orientation[, parent=None])
- param parent
- param orientation
取向
Constructs a vertical slider with the given
parent
.
Constructs a slider with the given
parent
。
orientation
parameter determines whether the slider is horizontal or vertical; the valid values are
Vertical
and
Horizontal
.
PySide2.QtWidgets.QSlider.
TickPosition
¶
This enum specifies where the tick marks are to be drawn relative to the slider’s groove and the handle the user moves.
|
常量 |
描述 |
|---|---|
|
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 |
PySide2.QtWidgets.QSlider.
initStyleOption
(
option
)
¶
option
–
QStyleOptionSlider
初始化
option
采用值来自此
QSlider
。此方法对子类是有用的,当需要
QStyleOptionSlider
, but don’t want to fill in all the information themselves.
另请参阅
PySide2.QtWidgets.QSlider.
setTickInterval
(
ti
)
¶
ti
–
int
另请参阅
PySide2.QtWidgets.QSlider.
setTickPosition
(
position
)
¶
position
–
TickPosition
另请参阅
PySide2.QtWidgets.QSlider.
tickInterval
(
)
¶
int
另请参阅
PySide2.QtWidgets.QSlider.
tickPosition
(
)
¶
另请参阅