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
1
vote
0 answers

In Qt source, where to find the code for drawing controls on default Mac OS style?

I know QCommonStyle inherits QStyle, and QWindowsStyle inherits QCommonStyle, and QWindowsXPStyle inherits QWindowsStyle. If my application has a control (for example QSlider) and I debug it on Windows XP, then I can set a breakpoint on…
Royt
  • 199
  • 4
  • 14
1
vote
1 answer

PyQt4 : Sync between QSpinbox and QSlider

I make a relation between QSpinbox and QSlider. QSpinbox has a range -10.0 to 10.0, and QSlider has a range -100 to 100. So, the value of QSlider divided by 10 is connect to QSpinbox, and vice versa. I use "valueChanged()" SIGNAL to each other. And…
Hyun-geun Kim
  • 919
  • 3
  • 22
  • 37
1
vote
2 answers

QSlider is not sliding

Somehow my QSlider is not sliding. I am only able to click on the slider and then the slider changes his position. I have checked with examples but everything seems to be the same. Here is one of my QSliders: QSlider *obj_scale_x= new…
buddy
  • 821
  • 2
  • 12
  • 30
1
vote
1 answer

In pyqt6, why QSlider cannot see handler after using qss?

class VideoProgressSlider(QSlider): def __init__(self, orientation: Qt.Orientation = Qt.Orientation.Horizontal): super().__init__(orientation) self.__initUI() def __initUI(self): self.setMinimumHeight(100) …
x0rb64
  • 13
  • 4
1
vote
1 answer

Adding a QSlider using Qt

I would like to add a QSlider in a QToolButton just like volume control in windows OS. Can any body help me how to achieve this in Qt?
user942502
  • 111
  • 1
  • 7
1
vote
0 answers

Removing focus border from QSlider in PyQt

I am looking for a solution to remove a terrible looking focus rectangle over a QSlider. In addition that it looks terrible, it covers the ticks and is not entirely drawn. This is an ancient issue; I remember stumbling into it many years ago. The…
Jan Bodnar
  • 10,969
  • 6
  • 68
  • 77
1
vote
0 answers

Qt QSlider odd behaviour when changing widget with

I've been noticing an odd behavior with QSlider, which can be reproduced whenever slider widgets have different width, eg. being resized. Is it a problem with my signals? if so, how would I go about updating slider2 when slider1 has been updated,…
Oliver Larsen
  • 33
  • 1
  • 6
1
vote
1 answer

QSlider with "arbitrary" values (from list/array)?

I ended up with a subclass of QSlider like this: # via https://stackoverflow.com/a/49744383/6197439 class ListSlider(QSlider): def __init__(self, vallist, *args, **kwargs): QSlider.__init__(self, *args, **kwargs) self.valuelist = vallist …
sdbbs
  • 4,270
  • 5
  • 32
  • 87
1
vote
0 answers

pyQt5 Qslider with labels

I have created a Qt form with a QSlider in it as shown below. self.np_label = QLabel("Number of Processors") self.np_slider = QSlider(Qt.Horizontal) self.np_slider.setFocusPolicy(Qt.NoFocus) self.np_slider.setMinimum(0) …
najeem
  • 1,841
  • 13
  • 29
1
vote
1 answer

QSlider with Text at the tick marks

I have some horizontal QSliders in my Qt application with 4-5 ticks marks. How can I add QLabels above the slider ticks to reflect the value at each of the ticks? I suspect the best way to do this is to create a subclass of QSlider and override the…
Django
  • 361
  • 2
  • 15
1
vote
1 answer

Align QSlider with an above QLabel that contains a QPixmap

I am trying to align a QSlider and a QLabel that I have in a QGridBoxLayout For reference, this is for viewing frames in a video, which are shown elsewhere. The QLabel here is for showing labelled sections of the video, with green sections being…
1
vote
1 answer

Updating slider value constantly crashes program

Maybe I'm doing this completely wrong here, I'm trying to make the "timeline" for an mp3 player. Everything works and I've tried to set the slider to one value and it was fine. My problem is when I try updating the timeline as it keeps on freezing…
CaptainFS
  • 13
  • 3
1
vote
1 answer

How to set the size of the handle in a QSlider?

I'm trying to add some style to a QSlider I want to use a custom image as the handle that the user drags back and forth. While I've figured out how to use style sheets to have a custom icon drawn where the handle should be, the image is being…
kitfox
  • 4,534
  • 3
  • 17
  • 24
1
vote
1 answer

How do I recolor the Qslider handle without changing the standard slider shape?

When I change the standard slider with setStyleSheet: mySlider = new QSlider(Qt::Horizontal, this); mySlider->setStyleSheet("QSlider::handle:horizontal { border: 1px solid #777; background:#92B558;}"); The resulting slider looks like this: What…
Gpipe
  • 13
  • 3
1
vote
1 answer

QSlider with icons

Given a set of images, I'd like to move a QSlider such that every step shows a little thumbnail icon just above it representing one of the images. Any tips or suggestions?