Search code examples
qtpyqtpysideqtreewidget

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.


Solution

  • QHeaderView::resizeSection() should do the trick, in C++ it would look like this:

    myTreeWidget->headerView()->resizeSection(0 /*column index*/, 100 /*width*/);