Using 4.2, and have some issues w/ a QTableWidget.

First, and foremost, I'm trying to make cells completely unselectable and unfocus-able. I thought this would work for, but will not. Even w/ this below, all cells are both focus & select-friendly.

Qt Code:
  1. QTableWidget *tbl = new QTableWidget( 0, 8, this );
  2. tbl->setSelectionMode( QAbstractItemView::NoSelection );
  3. tbl->setFocusPolicy( Qt::NoFocus );
To copy to clipboard, switch view to plain text mode 

Also, I have a pretty simple piece of code (I thought). Read in a line, make a new row (at row 0 -- at the top of the widget), change the height of that row. I posted this on the QT Interest ML, and didn't get much help. AFAIK, there's no weird indexing. setRowHeight(x) should change the height of row x, no matter when it was added to the QTableWidget.

Qt Code:
  1. void mywidget::read_line()
  2. {
  3. char* cfg_file = getenv("FILE");
  4. QFile file( cfg_file );
  5.  
  6. if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
  7. while ( !file.atEnd() ) {
  8. QByteArray line = file.readLine();
  9. QStringList vals = QStringList::split( ',', line, 0 );
  10. if ( vals.size() == no_of_cols ) { // valid line of text
  11. tbl_trades->insertRow( 0 ); // new row
  12. tbl_trades->setRowHeight( 0, 20 ); // resize new row
  13. for ( int i = 0; i < no_of_cols; i++ ) { //
  14. QTableWidgetItem *temp = new QTableWidgetItem( vals[i] );
  15. tbl_trades->setItem( 0, i, temp );
  16. }
  17. }
  18. }
  19. }
  20. }
To copy to clipboard, switch view to plain text mode