使用Qt-Designer自动展开布局 [英] Auto-expanding layout with Qt-Designer
问题描述
我正在使用Qt设计器.
I'm using the Qt Designer.
我想创建一个QVBoxLayout
,它将自动展开以填充整个窗口.
I want to create a QVBoxLayout
which will automatically expand to fill the whole window.
QVBoxLayout
的布局保持不变.
如何通过设计器使QVBoxLayout
展开并填充整个窗口?
How can I cause the QVBoxLayout
to expand and fill the entire window through the designer?
推荐答案
在Qt Designer中创建QVBoxLayout
后,右键单击窗口小部件/对话框/窗口(不是QVBoxLayout
,而是父级)的背景小部件),然后从上下文菜单的底部选择布局->在网格中布局.现在,QVBoxLayout
应该可以拉伸以适合窗口,并且在调整整个窗口的大小时会自动调整大小.
After creating your QVBoxLayout
in Qt Designer, right-click on the background of your widget/dialog/window (not the QVBoxLayout
, but the parent widget) and select Lay Out -> Lay Out in a Grid from the bottom of the context-menu. The QVBoxLayout
should now stretch to fit the window and will resize automatically when the entire window is resized.
这篇关于使用Qt-Designer自动展开布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!