gpt4 book ai didi

c++ - Qt : How can I make a layout section stop expanding once the widgets its hosting stops expanding too

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:55:18 26 4
gpt4 key购买 nike

我正在尝试以下实验:

我有两个QpushButtons,比如PushAPushB。现在 PushAQHBoxLayout 中,PushB 也在它自己的 QHBoxLayout 中。这两个水平布局都在另一个 QHBoxLayout 布局中;让我们称它为 Horizo​​ntalParentLayout。这是问题开始的地方。 Horizo​​ntalParentLayout 的布局拉伸(stretch)系数为 1,4PushA 的最大宽度为 100。当 Horizo​​ntalParentLayout 被拉伸(stretch)时,托管 PushA 的水平布局也会增长,而 PushA 增长到一定大小(最大大小)然后停止。如果我继续扩展 Horizo​​ntalParentLayout 托管 PushA 的布局会继续增长。如下图所示。紫色箭头表示布局在增长,而小部件 Pushbutton 是固定的。我不希望这种情况发生。一旦其托管的小部件停止扩展两个,我如何使布局部分停止扩展。这是图像的样子

enter image description here

如有任何建议,我们将不胜感激。

最佳答案

左边的布局会变大,因为您已将其设置为这样做。这就是 layoutStretch 所做的。

尝试将 Horizo​​ntalParentLayout 上的拉伸(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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com