我需要将 QTreeWidget 中列的宽度设置为固定大小。 setColumnWidth() 似乎没有效果,给定 here 的代码导致编译器错误“'headerView': is not a member of 'QTreeWidget'”。

我正在使用 Qt 4.7.4。

最佳答案

QHeaderView::resizeSection() 可能适合你。尝试执行以下代码:
treeWidget->header()->resizeSection(index, width);

关于c++ - Qt:如何修复 QTreeWidget 的列宽?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17116369/

10-13 06:25