hi,I want to set the initial width can use QListWidget,and use splitter to adjust the size.
Asked
Active
Viewed 513 times
2 Answers
1
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))

Crispin
- 2,070
- 1
- 13
- 16
0
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);

Adrien Leravat
- 2,731
- 18
- 32