title: Getting a QSqlRecord from QSqlTableModel
body: <p>I have a <code>QSqlTableModel</code> which I want to add a <code>QSqlRecord</code> to it. I'm supposing <code>QSqlTableModel::record()</code> should return a <code>QSqlRecord</code> containing fields but no data. <a href="http://qt-project.org/doc/qt-4.8/qsqlquerymodel.html#record" rel="nofollow">Documentation</a> says:</p>
  
  <blockquote>
    <p><code>QSqlRecord QSqlQueryModel::record () const</code></p>
    
    <p>This is an overloaded function. Returns an empty record containing
    information about the fields of the current query. If the model is not
    initialized, an empty record will be returned.</p>
  </blockquote>
  
  <p>The problem is that <code>record</code> returns and empty record with no field:</p>
  
  <pre><code>// Prepare DB, open, initialize model, even ::select() on the model 
  this-&gt;record = this-&gt;model-&gt;record(); // &lt;== returns an empty record
  qDebug() &lt;&lt; record; // Prints: QSqlRecord( 0 ) 
  qDebug() &lt;&lt; record.count(); // Prints: 0
  // So these operation will do nothing:
  record.setValue("name","some foo");
  ...
  </code></pre>