[Solved] Can I hide all the Columns of QTableView?
I created a model based QTableView and set the QSqlQueryModel as it's model.
I'm feeding data to the model from a database table.
That table consists 25 columns and I want to show only 5 columns in tableview.
I'm asking that without writing @ui->tableview->hideColumn ( 0 )@
twenty times, can I simply hide all 25 columns at once and show five columns which are required.
you could use QSortFilterProxyModel and filter out the columns.
But calling hideColumn() in a loop would definitely the fastest way.
foreach( int col, columnsTohide );
ui->tableview->hideColumn ( col );
Thank you Raven I used your solution