0

I am working on an application with Qt/c++ that includes a QTreeWidget that has 2 columns. The column headers are "Name:" and "Value:".

I am logging more and more information to the QTreeWidget but when I run the application it opens smaller than the length of many items (Words), inside.

I want to dynamicially expand the column header's width according to the items inside the columns.

I would be really glad if someone could help me.

BUY
  • 705
  • 1
  • 11
  • 30
  • @cbuchart That was not the same with my question but it was similar. I should have checked for that question too. Thanks for guiding me to it. – BUY May 24 '18 at 06:18

1 Answers1

1

Because QTreeWidget inherits QTreeView you can do this for say column index 0:

ui->treeWidget->resizeColumnToContents(0);
acraig5075
  • 10,588
  • 3
  • 31
  • 50