Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.6
-
None
Description
QTreeWidget::setColumnWidth does not applies since Qt version 6.6.0.
Tree columns have the same width, column widths are ignored.
QHeaderView::setDefaultSectionSize set to 0 or -1, before the setColumnWidth call, seems to solve the issue.
QTreeWidget *tree = new QTreeWidget; tree->setHeaderLabels({"Filename", "Size", "Date"}); #if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) tree->header()->setDefaultSectionSize(0); #endif tree->setColumnWidth(0, 200); tree->setColumnWidth(1, 100); tree->addTopLevelItem(new QTreeWidgetItem({"file.file", "1 MB", "1970-01-01"}));
Attachments
Issue Links
- duplicates
-
QTBUG-122109 QTreeWidget's columns do not seem to resize properly after upgrading from Qt6.5.3 to Qt6.1.1
- Closed