- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试以下实验:
我有两个QpushButtons
,比如PushA
和PushB
。现在 PushA
在 QHBoxLayout
中,PushB
也在它自己的 QHBoxLayout
中。这两个水平布局都在另一个 QHBoxLayout
布局中;让我们称它为 HorizontalParentLayout
。这是问题开始的地方。 HorizontalParentLayout
的布局拉伸(stretch)系数为 1,4
,PushA
的最大宽度为 100
。当 HorizontalParentLayout
被拉伸(stretch)时,托管 PushA
的水平布局也会增长,而 PushA
增长到一定大小(最大大小)然后停止。如果我继续扩展 HorizontalParentLayout
托管 PushA
的布局会继续增长。如下图所示。紫色箭头表示布局在增长,而小部件 Pushbutton
是固定的。我不希望这种情况发生。一旦其托管的小部件停止扩展两个,我如何使布局部分停止扩展。这是图像的样子
如有任何建议,我们将不胜感激。
最佳答案
左边的布局会变大,因为您已将其设置为这样做。这就是 layoutStretch
所做的。
尝试将 HorizontalParentLayout
上的拉伸(stretch)因子设置为 0、4(即第一列没有拉伸(stretch))。
关于c++ - Qt : How can I make a layout section stop expanding once the widgets its hosting stops expanding too,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20451115/
我是一名优秀的程序员,十分优秀!