I just switched my app from using a QTableWidget to a QTableView and suddenly I cannot get word wrap to shut off.

My tableview has 5 columns 4 of which are hidden.

Qt Code:
  1. myTable = new QTableView( this );
  2. myTable->setModel( myModel );
  3.  
  4. myTable->verticalHeader()->setVisible( false );
  5. myTable->setEditTriggers( QAbstractItemView::NoEditTriggers );
  6. myTable->setShowGrid( false );
  7. myTable->setWordWrap( false );
  8. myTable->horizontalHeader()->setStretchLastSection( false );
  9. myTable->horizontalHeader()->resizeSections( QHeaderView::ResizeToContents );
  10. //
  11. // I have also tried, instead of calling resizeSections, the following
  12. // mySequenceTable->horizontalHeader()->setResizeMode( 0, QHeaderView::Interactive );
  13. // mySequenceTable->horizontalHeader()->setResizeMode( 1, QHeaderView::ResizeToContents );
  14.  
  15. myTable->horizontalHeader()->setSectionHidden( 2, true );
  16. myTable->horizontalHeader()->setSectionHidden( 3, true );
  17. myTable->horizontalHeader()->setSectionHidden( 4, true );
  18.  
  19. myTable->setSelectionBehavior( QAbstractItemView::SelectRows );
  20. myTable->setSelectionMode( QAbstractItemView::SingleSelection );
  21. myTable->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
  22. myTable->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
To copy to clipboard, switch view to plain text mode 

The problem is that when an extremely long string is displayed in column 1 the text is wrapped. I'm need either a scroll bar (or if the scrollbar is set to off, the ellipses.) But I am always getting a wrapped string. The example above gives me a small column that I can drag to widden and when the column with becomes bigger than the QTableView then I do get the horizontal scrollbar, but I need the column to make itself bigger when the data appears in the model.

I have tried a few dozen iterations of this and am getting the same result. Can anyone offer a suggestion?