起作用吗?[/quote]
不起作用啊
我是自己继承了一个QWidget,上面有几个label和lineEdt,然后widget上设置了这些label和lineEdt的布局。现在想让这个widget窗口高度随着宽度变化。
文档所说setSizePolicy使用条件是布局存在,如下
This property holds the default layout behavior of the widget.
If there is a QLayout that manages this widget's children, the size policy specified by that layout is used. If there is no such QLayout, the result of this function is used.
感觉我使用方法没有错,就是没作用。