QAbstractSlider¶
The
QAbstractSlider
class provides an integer value within a range. More…
Inherited by: QDial, QScrollBar, QSlider
Synopsis¶
Functions¶
def
hasTracking
()def
invertedAppearance
()def
invertedControls
()def
isSliderDown
()def
maximum
()def
minimum
()def
orientation
()def
pageStep
()def
repeatAction
()def
setInvertedAppearance
(arg__1)def
setInvertedControls
(arg__1)def
setMaximum
(arg__1)def
setMinimum
(arg__1)def
setPageStep
(arg__1)def
setRepeatAction
(action[, thresholdTime=500[, repeatTime=50]])def
setSingleStep
(arg__1)def
setSliderDown
(arg__1)def
setSliderPosition
(arg__1)def
setTracking
(enable)def
singleStep
()def
sliderPosition
()def
triggerAction
(action)def
value
()
Virtual functions¶
def
sliderChange
(change)
Slots¶
def
setOrientation
(arg__1)def
setRange
(min, max)def
setValue
(arg__1)
Signals¶
def
actionTriggered
(action)def
rangeChanged
(min, max)def
sliderMoved
(position)def
sliderPressed
()def
sliderReleased
()def
valueChanged
(value)
Detailed Description¶
The class is designed as a common super class for widgets like
QScrollBar
,QSlider
andQDial
.Here are the main properties of the class:
value
: The bounded integer thatQAbstractSlider
maintains.
minimum
: The lowest possible value.
maximum
: The highest possible value.
singleStep
: The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.
pageStep
: The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.
tracking
: Whether slider tracking is enabled.
sliderPosition
: The current position of the slider. Iftracking
is enabled (the default), this is identical tovalue
.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 justminimum()
+ n *singleStep()
for integer values of n . Some widgets may allow the user to set any value at all; others may just provide multiples ofsingleStep()
orpageStep()
.
QAbstractSlider
emits a comprehensive set of signals:
Signal
Emitted when
the value has changed. The
tracking
determines whether this signal is emitted during user interaction.the user starts to drag the slider.
the user drags the slider.
the user releases the slider.
a slider action was triggered.
a the range has changed.
QAbstractSlider
provides a virtualsliderChange()
function that is well suited for updating the on-screen representation of sliders. By callingtriggerAction()
, subclasses trigger slider actions. Two helper functionssliderPositionFromValue()
andsliderValueFromPosition()
help subclasses and styles to map screen coordinates to logical range values.
- class PySide2.QtWidgets.QAbstractSlider([parent=None])¶
- param parent:
Constructs an abstract slider.
The
parent
argument is sent to theQWidget
constructor.The
minimum
defaults to 0, themaximum
to 99, with asingleStep
size of 1 and apageStep
size of 10, and an initialvalue
of 0.
- PySide2.QtWidgets.QAbstractSlider.SliderAction¶
Constant
Description
QAbstractSlider.SliderNoAction
QAbstractSlider.SliderSingleStepAdd
QAbstractSlider.SliderSingleStepSub
QAbstractSlider.SliderPageStepAdd
QAbstractSlider.SliderPageStepSub
QAbstractSlider.SliderToMinimum
QAbstractSlider.SliderToMaximum
QAbstractSlider.SliderMove
- PySide2.QtWidgets.QAbstractSlider.SliderChange¶
Constant
Description
QAbstractSlider.SliderRangeChange
QAbstractSlider.SliderOrientationChange
QAbstractSlider.SliderStepsChange
QAbstractSlider.SliderValueChange
- PySide2.QtWidgets.QAbstractSlider.actionTriggered(action)¶
- Parameters:
action – int
- PySide2.QtWidgets.QAbstractSlider.hasTracking()¶
- Return type:
bool
This property holds whether slider tracking is enabled.
If tracking is enabled (the default), the slider emits the
valueChanged()
signal while the slider is being dragged. If tracking is disabled, the slider emits thevalueChanged()
signal only when the user releases the slider.See also
sliderDown
- PySide2.QtWidgets.QAbstractSlider.invertedAppearance()¶
- Return type:
bool
This property holds whether or not a slider shows its values inverted..
If this property is
false
(the default), the minimum and maximum will be shown in its classic position for the inherited widget. If the value is true, the minimum and maximum appear at their opposite location.Note: This property makes most sense for sliders and dials. For scroll bars, the visual effect of the scroll bar subcontrols depends on whether or not the styles understand inverted appearance; most styles ignore this property for scroll bars.
- PySide2.QtWidgets.QAbstractSlider.invertedControls()¶
- Return type:
bool
This property holds whether or not the slider inverts its wheel and key events..
If this property is
false
, scrolling the mouse wheel “up” and using keys like page up will increase the slider’s value towards its maximum. Otherwise pressing page up will move value towards the slider’s minimum.
- PySide2.QtWidgets.QAbstractSlider.isSliderDown()¶
- Return type:
bool
This property holds whether the slider is pressed down..
The property is set by subclasses in order to let the abstract slider know whether or not
tracking
has any effect.Changing the slider down property emits the
sliderPressed()
andsliderReleased()
signals.
- PySide2.QtWidgets.QAbstractSlider.maximum()¶
- Return type:
int
This property holds the slider’s maximum value.
When setting this property, the
minimum
is adjusted if necessary to ensure that the range remains valid. Also the slider’s current value is adjusted to be within the new range.
- PySide2.QtWidgets.QAbstractSlider.minimum()¶
- Return type:
int
This property holds the sliders’s minimum value.
When setting this property, the
maximum
is adjusted if necessary to ensure that the range remains valid. Also the slider’s current value is adjusted to be within the new range.
- PySide2.QtWidgets.QAbstractSlider.orientation()¶
- Return type:
This property holds the orientation of the slider.
The orientation must be
Vertical
(the default) orHorizontal
.
- PySide2.QtWidgets.QAbstractSlider.pageStep()¶
- Return type:
int
This property holds the page step..
The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.
See also
- PySide2.QtWidgets.QAbstractSlider.rangeChanged(min, max)¶
- Parameters:
min – int
max – int
- PySide2.QtWidgets.QAbstractSlider.repeatAction()¶
- Return type:
Returns the current repeat action.
See also
- PySide2.QtWidgets.QAbstractSlider.setInvertedAppearance(arg__1)¶
- Parameters:
arg__1 – bool
This property holds whether or not a slider shows its values inverted..
If this property is
false
(the default), the minimum and maximum will be shown in its classic position for the inherited widget. If the value is true, the minimum and maximum appear at their opposite location.Note: This property makes most sense for sliders and dials. For scroll bars, the visual effect of the scroll bar subcontrols depends on whether or not the styles understand inverted appearance; most styles ignore this property for scroll bars.
- PySide2.QtWidgets.QAbstractSlider.setInvertedControls(arg__1)¶
- Parameters:
arg__1 – bool
This property holds whether or not the slider inverts its wheel and key events..
If this property is
false
, scrolling the mouse wheel “up” and using keys like page up will increase the slider’s value towards its maximum. Otherwise pressing page up will move value towards the slider’s minimum.
- PySide2.QtWidgets.QAbstractSlider.setMaximum(arg__1)¶
- Parameters:
arg__1 – int
This property holds the slider’s maximum value.
When setting this property, the
minimum
is adjusted if necessary to ensure that the range remains valid. Also the slider’s current value is adjusted to be within the new range.
- PySide2.QtWidgets.QAbstractSlider.setMinimum(arg__1)¶
- Parameters:
arg__1 – int
This property holds the sliders’s minimum value.
When setting this property, the
maximum
is adjusted if necessary to ensure that the range remains valid. Also the slider’s current value is adjusted to be within the new range.
- PySide2.QtWidgets.QAbstractSlider.setOrientation(arg__1)¶
- Parameters:
arg__1 –
Orientation
This property holds the orientation of the slider.
The orientation must be
Vertical
(the default) orHorizontal
.
- PySide2.QtWidgets.QAbstractSlider.setPageStep(arg__1)¶
- Parameters:
arg__1 – int
This property holds the page step..
The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.
See also
- PySide2.QtWidgets.QAbstractSlider.setRange(min, max)¶
- Parameters:
min – int
max – int
Sets the slider’s minimum to
min
and its maximum tomax
.If
max
is smaller thanmin
,min
becomes the only legal value.
- PySide2.QtWidgets.QAbstractSlider.setRepeatAction(action[, thresholdTime=500[, repeatTime=50]])¶
- Parameters:
action –
SliderAction
thresholdTime – int
repeatTime – int
Sets action
action
to be triggered repetitively in intervals ofrepeatTime
, after an initial delay ofthresholdTime
.See also
- PySide2.QtWidgets.QAbstractSlider.setSingleStep(arg__1)¶
- Parameters:
arg__1 – int
This property holds the single step..
The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.
If the property is modified during an auto repeating key event, behavior is undefined.
See also
- PySide2.QtWidgets.QAbstractSlider.setSliderDown(arg__1)¶
- Parameters:
arg__1 – bool
This property holds whether the slider is pressed down..
The property is set by subclasses in order to let the abstract slider know whether or not
tracking
has any effect.Changing the slider down property emits the
sliderPressed()
andsliderReleased()
signals.
- PySide2.QtWidgets.QAbstractSlider.setSliderPosition(arg__1)¶
- Parameters:
arg__1 – int
This property holds the current slider position.
If
tracking
is enabled (the default), this is identical tovalue
.
- PySide2.QtWidgets.QAbstractSlider.setTracking(enable)¶
- Parameters:
enable – bool
This property holds whether slider tracking is enabled.
If tracking is enabled (the default), the slider emits the
valueChanged()
signal while the slider is being dragged. If tracking is disabled, the slider emits thevalueChanged()
signal only when the user releases the slider.See also
sliderDown
- PySide2.QtWidgets.QAbstractSlider.setValue(arg__1)¶
- Parameters:
arg__1 – int
This property holds the slider’s current value.
The slider forces the value to be within the legal range:
minimum
<=value
<=maximum
.Changing the value also changes the
sliderPosition
.
- PySide2.QtWidgets.QAbstractSlider.singleStep()¶
- Return type:
int
This property holds the single step..
The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.
If the property is modified during an auto repeating key event, behavior is undefined.
See also
- PySide2.QtWidgets.QAbstractSlider.sliderChange(change)¶
- Parameters:
change –
SliderChange
Reimplement this virtual function to track slider changes such as
SliderRangeChange
,SliderOrientationChange
,SliderStepsChange
, orSliderValueChange
. The default implementation only updates the display and ignores thechange
parameter.
- PySide2.QtWidgets.QAbstractSlider.sliderMoved(position)¶
- Parameters:
position – int
- PySide2.QtWidgets.QAbstractSlider.sliderPosition()¶
- Return type:
int
This property holds the current slider position.
If
tracking
is enabled (the default), this is identical tovalue
.
- PySide2.QtWidgets.QAbstractSlider.sliderPressed()¶
- PySide2.QtWidgets.QAbstractSlider.sliderReleased()¶
- PySide2.QtWidgets.QAbstractSlider.triggerAction(action)¶
- Parameters:
action –
SliderAction
Triggers a slider
action
. Possible actions areSliderSingleStepAdd
,SliderSingleStepSub
,SliderPageStepAdd
,SliderPageStepSub
,SliderToMinimum
,SliderToMaximum
, andSliderMove
.See also
- PySide2.QtWidgets.QAbstractSlider.value()¶
- Return type:
int
This property holds the slider’s current value.
The slider forces the value to be within the legal range:
minimum
<=value
<=maximum
.Changing the value also changes the
sliderPosition
.
- PySide2.QtWidgets.QAbstractSlider.valueChanged(value)¶
- Parameters:
value – int
© 2022 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.