如何允许用户使用 Qt 设计器调整窗口内元素的大小? [英] How can I allow user resize on elements within the window using Qt designer?

查看:69
本文介绍了如何允许用户使用 Qt 设计器调整窗口内元素的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望允许使用我的应用程序的用户能够在我的窗口中拖动两个小部件之间的边界,这将调整两个小部件的大小(即向下拖动它,顶部会变大而底部变小,并且反之亦然).

Qt 设计器中是否有任何内容允许用户在特定约束内调整窗口中元素的大小?

谢谢

解决方案

您所描述的称为

I want to allow a user using my application to be able to drag a boundary between two widgets in my window which will resize the two (i.e. you drag it down and the top one will get bigger while the bottom gets smaller, and vice-versa).

Is there anything in Qt designer that will allow a user to resize an element in the window, within certain constraints?

Thank you

解决方案

What you're describing is called a QSplitter widget. In Qt Designer, you can create one by selecting 2 or more widgets, and then clicking the splitter button on the toolbar at the top. It's in the same location as the layout buttons. It will place those widgets inside a QSplitter. You still need to place the splitter widget inside another layout. It will create a handle between them to let you resize the portion that each widget gets.

这篇关于如何允许用户使用 Qt 设计器调整窗口内元素的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆