I have a QTableWidget with 2 columns, with a QHeaderView.
I left align all QTableWidgetItems in the left column, center align the right column QTableWidgetItems.
How do I now do this aligning of text to my QHeaderView? Currently both columns are center aligned, I want the first column header to be left aligned, the right column header to be center aligned.
This is my code for adding the QHeaderView in my class:

Qt Code:
  1. setRowCount(0);
  2. setColumnCount(2);
  3. setColumnWidth(0, 400); //set width of 1st column, 2nd column will auto-fit to remaining space
  4.  
  5. QHeaderView *header = this->horizontalHeader();
  6. header->setSectionResizeMode(1, QHeaderView::Stretch); //let last column stretch to fit the table
  7. QStringList headerLabels;
  8. headerLabels << "Start of Stoppage" << "Duration";
  9. setHorizontalHeaderLabels(headerLabels);
  10. QFont *font = new QFont("Helvetica",20);
  11. horizontalHeader()->setFont(*font);
To copy to clipboard, switch view to plain text mode 

Thank you, I appreciate any help on this.