Reputation: 165
hi,I want to set the initial width can use QListWidget,and use splitter to adjust the size.
but now,when I use the splitter, is like this.
Upvotes: 1
Views: 541
Reputation: 2120
There's no way to set initial sizes of QSplitter
children using Qt Designer. Once you've converted from .ui to .py, you can set the size of each pane using setSizes(list_of_sizes)
. i.e. for a two-pane window:
splitter = QtWidgets.QSplitter()
splitter.setSizes((50,100))
Upvotes: 1
Reputation: 2789
When using the QSplitter
class, you have the setSizes
method, which is basically a list of width corresponding to each children
QList<int> widgetsWidth;
widgetsWidth << 100 << 100 << 100 << 400;
ui->mySplitter->setSizes(widgetsWidth);
Upvotes: 0