title: Qt hide column in QTableView
body: <p>I want to hide the <code>ID</code> column in the <code>QtableView</code> and i can't do that on my implementation. Can anyone help me?</p>
  
  <pre><code>void MainWindow::on_actionClear_Search_triggered()
  {
  model = new QStandardItemModel(cars.size(),6,this);
  //create header
  createHeader(model);
  //set data to the table view
  populate(cars);
  
  ui-&gt;tableView-&gt;setColumnHidden(6,true);
  ui-&gt;tableView-&gt;setModel(model);
  
  
  }
  
  void MainWindow::createHeader(QStandardItemModel *model){
  
  
  model-&gt;setHorizontalHeaderItem(0,new QStandardItem("Car"));
  model-&gt;setHorizontalHeaderItem(1, new QStandardItem("Type"));
  model-&gt;setHorizontalHeaderItem(2, new QStandardItem("Mileage"));
  model-&gt;setHorizontalHeaderItem(3, new QStandardItem("Year"));
  model-&gt;setHorizontalHeaderItem(4, new QStandardItem("Is registered"));
  model-&gt;setHorizontalHeaderItem(5, new QStandardItem("ID"));
  }
  
  void MainWindow::populate(const QList&lt;Vehicle&gt; &amp;vehicles)
  {
  int j = 0;
  QList&lt;Vehicle&gt;::ConstIterator iter;
  for( iter= vehicles.begin(); iter != vehicles.end(); iter++){
      const Vehicle&amp; car = *iter;
      //set car
      QString makeAndModel = car.getGeneralData().getMake() + car.getGeneralData().getModel();
      QStandardItem *mAndM = new QStandardItem(QString(makeAndModel));
      mAndM-&gt;setEditable(false);
      model-&gt;setItem(j,0,mAndM);
  
      //set type
      QStandardItem *type = new QStandardItem(QString(car.getGeneralData().getType()));
      type-&gt;setEditable(false);
      model-&gt;setItem(j,1,type);
  
      //set mileage
      QString mileageString = QString::number(car.getGeneralData().getMileage());
      QStandardItem *mileage = new QStandardItem(QString(mileageString));
      mileage-&gt;setEditable(false);
      model-&gt;setItem(j,2,mileage);
  
      //set year
      QString yearString = QString::number(car.getGeneralData().getYear());
      QStandardItem *year = new QStandardItem(QString(yearString));
      year-&gt;setEditable(false);
      model-&gt;setItem(j,3,year);
  
      //set registration
      QString regString = VehicleHelper::convertBoolToString(car.getRegistration().isRegistered());
      QStandardItem *regDate = new QStandardItem(QString(regString));
      regDate-&gt;setEditable(false);
      model-&gt;setItem(j,4,regDate);
  
  
      //set ID column
      QStandardItem *idNumber = new QStandardItem(QString(car.getVehicleID().getID()));
      idNumber-&gt;setEditable(false);
      model-&gt;setItem(j,5,idNumber);
      j++;
  }
  
  }
  </code></pre>