如图所示,我已经在ui designer里面设置了groupbox,里面有一些lineedit等子控件。当我在代码里面把这个groupbox加入到layout以后,groupbox的整个大小,边框都能够正确缩放。
但是,里面的子控件,如下图,仍然是挤在一起的。没有随着groupbox一起缩放?是什么原因呢难道 ui designer里面的都不支持layout吗?
走同样的路,发现不同的人生
No. It’s because you didn’t use the QGridLayout layout. In ui designer, click on the blank space of the form. Then Ctrl+G, that is, all the controls on the form are in the QGridLayout layout. That’s it.
QGridLayout
ui designer
Ctrl+G
No. It’s because you didn’t use the
QGridLayout
layout. Inui designer
, click on the blank space of the form. ThenCtrl+G
, that is, all the controls on the form are in theQGridLayout
layout. That’s it.