title: How to open Subdirectories in a directories by using recursive function?
body: <p>My program is already works well but I want to add one more condition. The program opens a directory and display .h and .cpp files. But if there is a subdirectory, I can not see the .cpp and .h files inside subdirectory. Here is my code:</p>
  <pre><code>QFileInfoList MainWindow::getFileListFromDir(const QString &amp;directory)
  {
      QDir qdir(directory);
      QFileInfoList fileList = qdir.entryInfoList(QStringList() &lt;&lt; &quot;*.h&quot;  &lt;&lt; &quot;*.hpp&quot; &lt;&lt; &quot;*.c&quot; &lt;&lt; &quot;*.cpp&quot;, QDir::Files | QDir::AllDirs
                                                                                                    | QDir::NoDotAndDotDot);
      QStringList files;
  
      return fileList;
  }
  
  void MainWindow::on_Browse_clicked()
  {
      QString path = QFileDialog::getExistingDirectory(this, tr(&quot;Open Directory&quot;), &quot;/home&quot;, QFileDialog::ShowDirsOnly |
                                                                                        QFileDialog::DontResolveSymlinks);
      if(path.isEmpty())
          return;
  
      ui-&gt;FullPath-&gt;setText(path);
  }
  
   void MainWindow::on_Ok_clicked()
  {
      QString path = ui-&gt;FullPath-&gt;text();
      if(path.isEmpty())
          return;
  
      ui-&gt;tableWidget-&gt;setRowCount(0);
  
      QFileInfoList fileList = getFileListFromDir(path);
      int count = 0;
  
      foreach(const QFileInfo&amp; file, fileList)
      { 
          count = m_ig-&gt;funcCountLines(file.filePath());
          addItemToList(file.filePath(), file.size(), count);
      }
  }
  </code></pre>