Questions tagged [qslider]

QSlider is a Qt class that represents a vertical or horizontal slider.

A slider lets a user move a handle along a horizontal or vertical line, and then translates the handle position into a value within a range.

To use QSlider, a number of options must be set, including:

  • minimum value through setMinimum()
  • maximum value through setMaximum()
  • step value through setSingleStep()

A minimalistic example of a QSlider looks like this:

QSlider *s = new QSlider();
s->setMaximum(100);
s->setMinimum(0);
s->setSingleStep(1);
s->show();

Official documentation can be found here.

147 questions
48
votes
12 answers

QSlider mouse direct jump

Instead of stepping when the user clicks somewhere on the qslider I want to make the slider jump to that position. How can this be implemented ?
Vihaan Verma
  • 12,815
  • 19
  • 97
  • 126
34
votes
1 answer

QSlider Value Changed Signal

I'm using a QSlider (v4.6) for input as well as to provide feedback to the user. For the feedback I will be calling the setValue method. I'm trying to find a signal that will fire only if the user modified the value. The valueChanged signal fires…
David Alvares
  • 343
  • 1
  • 3
  • 4
33
votes
1 answer

Range slider in Qt (two handles in a QSlider)

I need a range selection using QSlider. Is it possible to get two handles, if not, is there any piece of code available to handle that smartly? Below is an image illustrating what I need.
Sivam
  • 1,099
  • 3
  • 12
  • 25
10
votes
2 answers

Is it possible to change the color of a QSlider's handle according to its position?

I pretty well understood how to customize a QSlider through style sheets, but I am wondering if it is possible to do the following thing:                                                I'd like the handle of the slider to go from blue to yellow.…
IAmInPLS
  • 4,051
  • 4
  • 24
  • 57
9
votes
3 answers

Moving QSlider to Mouse Click Position

I have a QSlider that I want to move to the position of the mouse cursor when the user presses the left mouse button. I've been hunting around and couldn't find anything that was recent and solved my problem. This is the slider I have. I want to be…
Eamonn
  • 658
  • 1
  • 7
  • 22
9
votes
2 answers

How to make a QSlider change with double values

My problem is that I just can't seem to make my QSlider work with double values instead of integer, because I need to make it return double values to a QLineEdit and also set it's own value when I put some value in the edit.
Isaac Kennedy
  • 179
  • 1
  • 1
  • 11
8
votes
3 answers

QSlider show min, max and current value

Is it possible to show minimum, maximum and current selected value of QSlider? Of course I can use labels to display this, but I think there must be such possibility in QSlider
Borrimoro
  • 529
  • 3
  • 9
  • 19
7
votes
3 answers

Use float for QSlider

I have a QLineEdit and a QSlider in which it interacts with each other. Eg. If I set a value in the QLineEdit, the slider will be updated, or if I slide the slider across, it will updates the value in QLineEdit # If user change value on the…
dissidia
  • 1,531
  • 3
  • 23
  • 53
7
votes
2 answers

tick marks disappear on styled QSlider

I'm using Qt 5.3 and trying to style a QSlider. However, when I apply my style-sheet, the tick marks disappear. Does anyone know how to keep the styling without affecting the tick marks? Here is the style sheet: QSlider::groove:horizontal { …
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97
6
votes
1 answer

how to display the range values in slider

Here is my code, i want to display the minimum and maximum range values for slider.I tried many ways but i didn't get anything.Can anyone please help me how to display the slider as shown in the bellow image. Given bellow is my code: from pyface.qt…
navya sri
  • 428
  • 5
  • 18
6
votes
4 answers

QSlider stepping?

I'd like to specify the steps that a QSlider can slide, like it is possible for the QSpinBox by using setSingleStep. I tried to use setSingleStep of QAbstractSlider, but this seems to have no effect. Any ideas?
Richard Durr
  • 3,081
  • 3
  • 20
  • 26
6
votes
2 answers

QSlider makes unnecessary steps

I am trying to use a QSlider, but if somebody clicks on a position X, where he wants to put the slider to, the slider always sets the value to maximum or minimum at first and then to the value X. So there is an unnecessary step in-betweeen. How can…
evilSquirrel
  • 61
  • 1
  • 2
5
votes
6 answers

How to connect a QSlider to QDoubleSpinBox

I want to connect a QSlider to a QDoubleSpinBox but while the code compiles fine and runs for simple QSpinBox, it doesn't work for QDoubleSpinBox QSlider *horizontalSlider1 = new QSlider(); QDoubleSpinBox *spinBox1 = new…
linello
  • 8,451
  • 18
  • 63
  • 109
5
votes
3 answers

Is it possible to expand the drawable area around the QSlider

My aim is to have a custom QSlider with tickmarks and tick labels in Python 3 using PySide2 module. In order to do so I edit the default paintEvent of the QSlider class in a derived class. However, it turns out that that the printable area is…
Vesnog
  • 773
  • 2
  • 16
  • 33
5
votes
2 answers

QSlider increase handle size

I need badly to increase size of handle for my slider, but no css options can do this(styleSheet()). The default example from Qt docs didn't help me as well. I have a slider like this: I wish to increase the height of its handle, as shown on…
Preonix
  • 53
  • 1
  • 1
  • 9
1
2 3
9 10