问题描述
我的视图中有一个尺寸的问题.
让我从图像开始,以帮助我解释
这是我表格的主要风扇.
发生的是:
我们有4个标签小部件.左侧标签小部件具有水平分离器,可到2个小部件. 两个小部件具有垂直分离器,左侧和右侧有一个水平分离器.
右小部件的左手有一个垂直分离器.
因此,所有视图均使用拆分器连接.
最后,Mainform使用水平布局以可重大的方式将所有内容粘在一起.
问题是,最左边和最右的小部件的宽度是固定的(在设计器中). 我希望它们的宽度较小.类似的东西:
您可以看到小部件已调整大小.我能够运行该应用程序,并手动调整拆分器. Qtdesigner有没有办法这样做?我尝试制定政策.但是我真的没有进一步.这是否表明我对政策缺乏了解?也许一般布局?
我应该使用哪些选项使用QTDesigner实现所需的布局.我想避免使用代码.
希望我能尽快解决.它必须忽略一些简单的东西.
推荐答案
例如,在顶部中央QTabWidget的垂直拉伸和中央QSplitter的水平拉伸和1个保持在0处的所有其他值,您都将获得所需的结果.
当您具有多个非零拉伸值时,在2个中心QTabWidget s => 2/3和1/3的比率的结果(例如:垂直率在2和1处).设计师,但在运行应用程序时似乎在工作.
ps:您也可以通过TabBified QDockWidget s实现相同的结果,但是仅通过设计师不可能进行码头tabbifitive.
其他推荐答案
我设置了开始位置:
QList<int> list= ui->splitter->sizes(); list.replace(0,this->height()/0.3); list.replace(1,this->height()/0.7); ui->splitter->setSizes(list);
请记住最小尺寸的儿童小部件
问题描述
I have an issue with size in my view made in Qt with drag and drop.
Let me start with an image to help me explain
This is the mainwindow for my form.
What happens is:
We have 4 tab widgets. the left tab widget has a horizontal splitter to the 2 mid widgets. The 2 mid widgets have a vertical splitter, and a horizontal splitter on the left and right side.
The right widget has a vertical splitter on its left hand.
So all views are connected using splitters.
Lastly the mainform sticks every thing together in a resizable way using horizontal layout.
The problem is, the width of the leftmost and rightmost widgets are fixed (in designer). I want them to be smaller in width. Something similar to:
You can see the widgets are resized. I was able to do this running the application, and manually adjusting the splitters. Is there a way in QtDesigner to do this? I tried playing with policies. I didn't really get any further however. Does this indicate a lack of knowledge of my part about policies? Perhaps layouts in general?
What options should I use to achieve the desired layout using QtDesigner. I want to avoid using code.
Hope I will be able to solve this soon. It must be overlooking something simple..
推荐答案
You can play with the "Horizontal Stretch" and "Vertical Stretch" properties to change the position of the split.
For example with both the vertical stretch of the top central QTabWidget and the horizontal stretch of the central QSplitter at 1 and all the other values kept at 0, you'll get the result you want.
When you have multiple non-zero stretch values, the result of the ratio (e.g.: vertical strech at 2 and 1 for the 2 central QTabWidgets => 2/3 and 1/3) is not visible in the designer but seems to be working when you run the application.
PS: You can also achieve the same result with tabbified QDockWidgets but the dock tabbification is not possible through the designer only.
其他推荐答案
I set start position that:
QList<int> list= ui->splitter->sizes(); list.replace(0,this->height()/0.3); list.replace(1,this->height()/0.7); ui->splitter->setSizes(list);
and remember to minimum size child widget