Today, we are learning a new input controls - QAbstractSlider () the underlying control slider control.
I. Description:
QAbstractSlider () is the QWidget () subclass provides a range of integer values. It is QSlider, QScrollBar and QDial parent class ( abstract class ), the common variety of slide controls abstract out.
QAbstractSlider () is an abstract class must be instantiated using subclassing. The following functional demo has QSlider to achieve.
II. Function
1. numerical range
The default control range is 0-9, you can be changed by setting.
QAbstractSlider.setMaximum (Self, A0: int) # set maximum QAbstractSlider.setMinimum (Self, A0: int) # set minimum QAbstractSlider.maximum () # Get the maximum value -> int QAbstractSlider.minimum () # Get minimum -> int
2. The current value
QAbstractSlider.setValue (Self, A0: int) # set current value QAbstractSlider.value () # Minimum Capture -> int
3. step
Step size value changed through operation of the keyboard. Into a single step length and step shifted sheet, single-step refers to a value changed by the vertical arrow (a default value), and the page is the shift step size and operating keyboard pageup PageDown (default 10) .
QAbstractSlider.setSingleStep (Self, A0: int) # set the single-step long QAbstractSlider.setPageStep (Self, A0: int) # Set shift Page change QAbstractSlider.singleStep () # get long single step -> int QAbstractSlider.pageStep () # get step-shift page -> int
4. Whether tracking
The track is set to launch major influence behind the signal, if you do not loose track of time, then mouse click before dragging the release signal is not sent, if track, then simply changing the position of the slider will send a signal that valuechanged of.
QAbstractSlider.setTracking (Self, enable: BOOL) # track settings QAbstractSlider.hasTracking () # Gets whether the track -> bool
The position of the slider
QAbstractSlider.setSliderPosition (Self, A0: int) # set the slider position QAbstractSlider.sliderPosition () # get the slider position -> int
Whether the set position of the slider and associated tracking can affect whether the code signal transmitted valuechanged
6. inverted appearance
By default controls are big value in a small below the above values, enabled the appearance of inverted put great value placed below.
QAbstractSlider.setInvertedAppearance (Self, A0: BOOL) # handstand appearance settings QAbstractSlider.invertedAppearance () # get is turned upside down -> bool
7. inversion operation
Default control keys on your keyboard to add or pageup value, or the subtraction value is pagedown. Inverting operation can be started up a subtraction value.
QAbstractSlider.setInvertedControls (Self, A0: BOOL) # set operation reversal QAbstractSlider.setInvertedControls () # Gets whether the operation reversed -> bool
8. slide direction
QAbstractSlider.setOrientation (Qt.Horizontal) # arrangement direction QAbstractSlider.orientation () # fetch direction -> int Qt.Horizontal # laterally, the default left and right small large, the return value. 1 Qt.Vertical # longitudinal returns the value 2
9. Are Press
This feature is used less, mainly to get the value. In fact, when no trace of valuechanged determination is based on whether the state is pressed. If the return value is False transmission signal.
QAbstractSlider.setSliderDown (Self, A0: BOOL) # set is pressed QAbstractSlider.isSliderDown () # get has been pressed -> bool
III. Signal
QAbstractSlider.valueChanged(self, value: int)
QAbstractSlider.sliderPressed(self)
QAbstractSlider.sliderMoved(self, position: int)
QAbstractSlider.sliderReleased(self)
QAbstractSlider.actionTriggered(self, action: int)
QAbstractSlider.rangeChanged(self, min: int, max: int)
It is the literal meaning, nothing to talk about! Only a actionTriggered to say it, it should state the following enumeration corresponding return value.
QAbstractSlider.SliderNoAction QAbstractSlider.SliderSingleStepAdd #1 QAbstractSlider.SliderSingleStepSub #2 QAbstractSlider.SliderPageStepAdd #3 QAbstractSlider.SliderPageStepSub #4 QAbstractSlider.SliderToMinimum #5 QAbstractSlider.SliderToMaximum #6 QAbstractSlider.SliderMove #7
But the first five or six slides to a minimum and maximum I did not try out, 7, is the return of the slider is triggered.