Set column width for QTreeWidget
问题 Is there any way to set column width for QTreeWidget from code? I want to chage default width of first column. I'm using PySide. 回答1: QHeaderView::resizeSection() should do the trick, in C++ it would look like this: myTreeWidget->headerView()->resizeSection(0 /*column index*/, 100 /*width*/); 回答2: For people looking for a C++ Qt solution (tested with 5.12): // Important to call setMinimumSectionSize because resizeSection wont work if your width is less than the minimum treeWidget->header()-