QT QSlider 边距
我正在制作一个由 QGridLayout 组成的小部件,它映射了 QSlider 和一些 QPushButtons。在我的小部件中,我可以将按钮放置在容器小部件的最右侧。然而,滑块的问题有点多。
我希望滑块的定位使得凹槽和手柄一直延伸到手柄可以与小部件边界齐平的位置。我尝试了一些方法,包括更改凹槽的样式表边距属性以及弄乱 QGridLayout 提供的功能,但我似乎不知道如何实现这一点。
有人有什么建议吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现没有简单、可靠的方法来确保 QSlider 在 QGridLayout 中动态调整大小。
我发现实现这样的小部件的最佳方法是使用 QWidget::move(x,y) 并使用相对于滑块大小/位置的坐标来放置标签。
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.