简体   繁体   English

QT 使用 QT Designer 调整布局大小?

[英]QT resizing layout with QT Designer?

I'm quite new to QT and i want a layout to be resized as the window is resized, resizing it's parents elements.我对 QT 很陌生,我希望在调整窗口大小时调整布局的大小,调整其父元素的大小。

Can I do it only using QT Designer?我可以只使用 QT Designer 吗? If not, how can I do it?如果没有,我该怎么做?

I currently have a WebView inside of a GridLayout inside of a Widget.我目前在 Widget 内的 GridLayout 中有一个 WebView。

I already tried to mess with elements properties, but can't find a reference on it.我已经尝试弄乱元素属性,但找不到关于它的参考。

EDIT: The Grid Layout object isn't shown on the UI object, but everything else does, it also has a red background on QT Design, while everything else is green.编辑:网格布局对象未显示在 UI 对象上,但其他所有内容都显示,它在 QT Design 上也具有红色背景,而其他所有内容均为绿色。

EDIT²: I've reseted the ui file, and added some more elements, the elements aren't being show on the app after being compiled, but they appear at ui preview, and resizing works there.编辑²:我已经重置了 ui 文件,并添加了更多元素,这些元素在编译后没有显示在应用程序上,但它们出现在 ui 预览中,并且在那里调整大小。

.ui file source code: http://pastebin.com/r3KYvvwj .ui 文件源代码: http : //pastebin.com/r3KYvvwj

OBS: the UI file generation seems messy, some elements aren't shown at QT Design(gridLayout_2). OBS:UI 文件生成看起来很乱,有些元素在 QT Design(gridLayout_2) 中没有显示。

Thanks in advance.提前致谢。

You need to specify a layout to the window.您需要为窗口指定布局。 You can specify a suitable layout to the window by relevant toolbar icons in the Qt Creator.您可以通过 Qt Creator 中的相关工具栏图标为窗口指定合适的布局。 First select the window and then click on a suitable layout toolbar button to specify a layout to the window.首先选择窗口,然后单击合适的布局工具栏按钮来指定窗口的布局。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM