PDA

View Full Version : QTableView: get the value of a removed column



trallallero
25th October 2013, 15:38
I use a QTableView with a QSqlTableModel.
There is a typical "Id" table field that the user should not see, so I remove it's relative column.
But if I want to execute a query like "DELETE FROM table WHERE Id = :id" I don't have the Id because it's column has been removed.

Is there an easy and elegant solution for that ?

stampede
25th October 2013, 15:58
I'm not using tableviews etc. much so I may be wrong, but shouldn't this


tableView->setColumnHidden(x,true);
// where x is the column number for "id" field

do the job ?

trallallero
25th October 2013, 16:05
I've always used that but for some unknown reason I thought that setColumnHidden had been removed!
Ok, thanks a lot.