Can't get this to work. Model and view have already been defined and view shows data - header looks fine.

Qt Code:
  1. header = new QHeaderView(Qt::Horizontal);
  2. view->setHorizontalHeader(header);
  3.  
  4. ha = header->saveState();
To copy to clipboard, switch view to plain text mode 

Compiles fine, runs with no errors.
Problem is the array is empty, but has size 426. No values in it.
What am I doing wrong?