문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top