I want to initialize the splitter handle position like the following instead of in the middle. I cannot set it in the property.
How to solve this?
You should set the horizontal stretch for the two widgets in the splitter. For instance by setting the horizontal stretch of the left widget to 1
and the right widget to 2
, the right widget gets a width 2 times the left one :
leftWidget->sizePolicy().setHorizontalStretch(1);
rightWidget->sizePolicy().setHorizontalStretch(2);
Another possible way is to use QSplitter::setSizes
.
Use QSplitter::setStretchFactor(int index, int stretch)
where index
is the position of the respective widget.
i was having the same issue but ull find a predefined attribute existing called
`self.horizontalLayout_6.setSpacing(0)`
u will also find a
self.verticalLayout_6.setSpacing(0)
u can change the spacing to whatever u like it worked for me