|
|
QSlider class object presents the user with a groove over which a manage may be moved. it is a classic widget to control a bounded cost. role of the manage at the groove is equal to an integer between the decrease and the higher bounds of the manage.
A slider manage may be displayed in horizontal or vertical manner by using mentioning the orientation in the constructor.
The following table lists some of the frequently used methods of QSlider class −
Given below are the most commonly used methods of QSlider.
S.No. |
Methods & Description |
||||||||||||
1 |
setMinimum() Sets the lower bound of the slider |
||||||||||||
2 |
setMaximum() Sets the upper bound of the slider |
||||||||||||
3 |
setSingleStep() Sets the increment/decrement step |
||||||||||||
4 |
setValue() Sets the value of the control programmatically |
||||||||||||
5 |
value() Returns the current value |
||||||||||||
6 |
setTickInterval() Puts the number of ticks on the groove |
||||||||||||
7 |
setTickPosition() Places the ticks on the groove. Values are −
|
S.No. |
Methods & Description |
1 |
valueChanged() When the slider's value has changed |
2 |
sliderPressed() When the user starts to drag the slider |
3 |
sliderMoved() When the user drags the slider |
4 |
sliderReleased() When the user releases the slider |
valueChanged() signal is the one which is most frequently used.
The following example demonstrates the above functionality. A Label and a horizontal slider is placed in a vertical format. Slider’s valueChanged() signal is attached to valuechange() technique.
The slot feature valuechange() reads current value of the slider and makes use of it as the size of font for label’s caption.
The complete code is as follows −
The above code produces the following output −
The font length of the label changes as handle of the slider is moved across the handle.
|
|
PyQt Related Tutorials |
|
---|---|
Python Tutorial | MATLAB Tutorial |
Framework7 Tutorial | Design Patterns Tutorial |
wxPython Tutorial | PyGTK Tutorial |
PyQt Related Practice Tests |
|
---|---|
Python Practice Tests | Geographic Information System (GIS) Practice Tests |
SQL Practice Tests | MATLAB Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.