I have created a QTreeWidget with 4 columns using a Designer. It works but my header columns are "1 2 3 4". I tried setHeaderLabels():

Qt Code:
  1. Tree::Tree( QWidget *parent ) : QTreeWidget(parent)
  2. {
  3. QStringList labels = {"title", "author", "source", "date" };
  4.  
  5. setHeaderLabels(labels);
  6.  
  7. TreeHeader = header(); // TreeHeader is QHeaderView *
  8.  
  9. TreeHeader->setResizeMode(0,QHeaderView::Stretch);
  10. TreeHeader->setSectionHidden(1,true);
  11. TreeHeader->setSectionHidden(2,true);
  12. TreeHeader->setSectionHidden(3,true);
  13. TreeHeader->setVisible(false);
  14. }
To copy to clipboard, switch view to plain text mode 

(At the beginning: we have no header and only one column in the view.) but I still have columns "1 2 3 4". Perhaps, because setHeaderLabels() adds columns instead of updating them according to the documentation. I have searched something what updates header labels but I have found nothing. How should I set the header labels?