title: How to write QVector fo txt file
body: <p>I'm trying to write QVector that consists of objects of my class to file and have some problems with it. I need to save some objects to .txt file, then read them out. But saving doesn't work correctly. What is the way i can release it?</p>
  
  <p>Film.h</p>
  
  <pre><code>class Film
  {
  public:
      QString title;
      int year;
      friend QDataStream &amp;operator&lt;&lt; (QDataStream &amp;stream, const Film obj)
      {
          stream &lt;&lt; obj.title; //title only while i'm testing my program
          return stream;
      }
      friend QDataStream &amp;operator&gt;&gt; (QDataStream &amp;stream, Film &amp;obj)
      {
          stream &gt;&gt; obj.title;
          return stream;
      }
  };
  </code></pre>
  
  <p>AddFilm.cpp</p>
  
  <pre><code>void AddFilm::slotOkButtonClicked()
  {
      QVector&lt;Film&gt; database;
      Film film;
      film.title = titleLine-&gt;text(); // QLineEdit where i input data
      film.year = yearLine-&gt;text().toInt(); // QLineEdit where i input data
      database.push_back(film);
      QFile file("database.fdtb");
      if(file.open(QIODevice::WriteOnly))
      {
          QDataStream out(&amp;file);
          out &lt;&lt; film;
          file.close();
      }
  </code></pre>