I want to hide the ID
column in the QtableView
and i can\'t do that on my implementation. Can anyone help me?
void MainWindow::on_a
You use ui->tableView->setColumnHidden(6, true);
, but there is no column with index 6. You should write ui->tableView->setColumnHidden(5, true);
instead, because ID column number is rather 5 than 6.
UPDATE:
You also need to hide column(s) after you set the model to the view, i.e:
ui->tableView->setModel(model);
ui->tableView->setColumnHidden(5, true);