title: QFile -- not reopening in text editor
body: <p>There are two slots for open &amp; close in my gui.
  When i open a file its content are shown in text editor, then i press close button changes are save to file.</p>
  
  <p>But Now when i again press, open &amp; reload the same file. Nothing is shown in text editor, blank editor.</p>
  
  <p>Why file is not reloading ?</p>
  
  <pre><code>private:
      Ui::MainWindow *ui;
  
      QFile file;
      QTextStream out;        
      QString url; // the url of the file
  
  
  
  void MainWindow::on_actionOpen_triggered()
  {
      QString openfileurl = QFileDialog::getOpenFileName();
      if(openfileurl.isEmpty() || openfileurl == url) return;
  
      file.setFileName(openfileurl);
  
      //if(file.open(QIODevice::ReadOnly|QIODevice::Text))
      if(file.open(QIODevice::ReadWrite|QIODevice::Text))
      {
          url = openfileurl;
          ui-&gt;textEdit-&gt;setPlainText(QString::fromUtf8(file.readAll()));
      }
  
      //Set file to -- Qtextstream
      out.setDevice(&amp;file);
  
  }
  
  void MainWindow::on_actionClose_triggered()
  {
      //Set file to -- Qtextstream
      out &lt;&lt; ui-&gt;textEdit-&gt;toPlainText();
  
      file.close();
      ui-&gt;textEdit-&gt;clear();
  
  }
  </code></pre>