在分割器中设置 pyqt 小部件的初始宽度
我正在使用 python 和 PyQt 设计一个简单的界面。
我的问题是:
如何在分隔符中设置 pyqt 小部件的初始宽度,同时仍然允许用户在拖动分隔符时对其进行修改?
我希望在应用程序首次启动时,分割器中的两个小部件之一变窄,并且我还希望用户能够通过拖动分割器来手动更改宽度。我尝试在 Qt-Designer 中设置最大宽度,然后当应用程序启动时,小部件变窄,但您无法拖动分界线来展开它。如果我没有设置任何最大宽度,那么当应用程序启动时,它们各自占据 50%,但我可以手动拖动分隔线来调整比例。
I am using python and PyQt to design a simple interface.
My question is this:
How do I set an initial width of a pyqt widget in a splitter while still allowing it to be modified by the user when they drag the divider?
I want one of the two widgets in the splitter to be narrower when the application first launches and I also want the user to be able to manually change the width by dragging on the divider. I tried setting the maximum width in Qt-Designer and then when the application launches the widget is narrower but you can not drag the dividing line to expand it. If I don't set any maximum widths then when the app launches they each take up 50% but I can drag the divider around manually to adjust the ratio.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你尝试过吗?:
你有这里一个工作示例
Did you try?:
You have here a working example