使用 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,但父小部件)并从上下文菜单底部选择布局 -> 在网格中布局.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屋!