title: QtCreator GUI open text file
body: <p>I made a push button that will browse and get a textfile. But I need to open it in a new window to check if the content of the textfile is correct. How do I do this? </p>
  
  <p>Also, I would like to have a line edit right next to the button that shows which file I'm looking at. In other words, the directory of the file that is opened through the button. </p>
  
  <p>Currently, this is what I have: </p>
  
  <pre><code>void MainWindow::on_fileButton_clicked()
  {
       QString fileName1 = QFileDialog::getOpenFileName(this,tr("Open Text File"), "", tr("Text Files (*.txt)"));
       QFile file1(fileName1);
       if(!file1.open(QIODevice::ReadOnly | QIODevice::Text))
           return;
  
       QTextStream in(&amp;file1);
       while(!in.atEnd()){
           QString line = in.readLine();
       }
  }
  </code></pre>