Question

I'm making a widget that consists of a QGridLayout which maps out a QSlider and a few QPushButtons. In my widget, I'm able to position the buttons against the rightmost side of the container widget. The slider, however, is a bit more problematic.

I want the slider to be positioned such that the groove and handle extend all the way over to the point where the handle can be positioned flush against the widget boundary. I've tried a few things including changing the stylesheet margin properties for the groove and messing with the functions provided by QGridLayout, but I can't seem to figure out how to accomplish this.

Does anyone have any suggestions?

Was it helpful?

Solution

I discovered that there is no easy, reliable method of ensuring that a QSlider be dynamically sizeable within a QGridLayout.

The best way of implementing a widget like this that I've found was to place the labels using QWidget::move(x,y) and using coordinates relative to the slider's size/position.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top