如何缩放qt中指定的小部件
我将主屏幕分为 4 个区域,边界布局为中心、右侧、左侧和底部。右侧、左侧和底部区域很小,仅包含按钮。我的中心区域必须根据右/左/底部区域中按下的按钮显示不同的小部件和表单。
任何人都可以建议我如何设计我的表单或小部件,以便当我在中心区域显示小部件时,它将适合中心区域,并且其中的所有项目都将合理缩放。
请参阅随附的图像文件以获得更好的想法。
如果我的解释不清楚,请告诉我,我会尽力更好。
I have divided my main screen in 4 areas as border-layout as center,right,left and bottom. The right, left and bottom areas are small and contain only buttons. My center area has to display the different widgets and forms depending on the buttons pressed in right/left/bottom areas.
Can anybody suggest how I can design my forms or widgets so that when I show the widget in the center area, it will fit into the center area and all the items inside this will be scaled rationally.
Please refer to the attached image file for a better idea.
If my explanation is not clear please let me know I will try better.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来你已经有了一个不错的开始。如果您只有图标,通常图标将无法扩展太多,因此您会希望左侧、底部和右侧容器不扩展。
中心容器(在您的情况下很可能是 QStackedWidget)将水平和垂直扩展。
您还需要在左侧区域和右侧区域的底部添加垫片。
底部区域两侧也可以使用垫片。
简而言之
以下是您可以在 QtDesigner 中通过拖放执行的操作
这是它的样子
这是展开后的样子。请注意,虽然主区域更大,但按钮侧面保持不变。
Looks like you already have a decent start. If you only have icons, typically icons won't be able to expand much so you will want your left,bottom and right containers to be non-expanding.
The center container (most likely a QStackedWidget in your case) will be expanding both horizontally and vertically.
You will also need to add spacers at the bottom of left area and right area.
The bottom area can also use spacers on both sides.
In short
Here is what you can do with drag and drop within QtDesigner
Here is what it looks like
Here is what it will look like expanded. Notice that although the main area is bigger, the buttons sides remain the same.