title: QTableView output save as .csv or .txt
body: <p>I wrote the below code for a qt gui to view the query output in a QTableView(Model oriented). now i want to save this output as a .csv or .txt file. There were suggestions to use QTableWidget(Item oriented) but I would like to stick to the model based approach.</p>
  
  <pre><code>void MainWindow::on_pushButton_clicked()
  {
  db = QSqlDatabase::addDatabase("QOCI");
  db.setHostName("host");
  db.setDatabaseName("db");
  db.setUserName("uid");
  db.setPassword("pw");
  db.setPort(port);
  
  QString MyQuery = ui-&gt;lineEdit-&gt;text();
  
  if (db.open())
  {
      qDebug()&lt;&lt;QDateTime::currentDateTime()&lt;&lt;"QUERY DONE SUCCESSFULLY ";
  
      this-&gt;model=new QSqlQueryModel();
      model-&gt;setQuery(MyQuery);
      ui-&gt;tableView-&gt;setModel(model);
  
  }
  else
  {
      qDebug()&lt;&lt;QDateTime::currentDateTime()&lt;&lt;"YOU FORGOT THE QUERY "&lt;&lt;db.lastError().text();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>any guidelines ???</p>