Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123807

QTreeWidget::setColumnWidth does not applies in 6.6.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.6.3, 6.7.0
    • 6.6
    • Widgets: Itemviews
    • None
    • All

      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"}));

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            ctlcltd Leonardo Laureti
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes