title: QDirIterator - No hasNext not FilePath reaction
body: <p>What I want to do is that it give me a list with all .cpp files in the Directory and the Subdirectories. Problem <em>it.HasNext</em> stay on false and also <em>it.filePath</em> stay empty.</p>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include "QtSignal_Slot.h"
  #include &lt;QtWidgets/QApplication&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      QtSignal_Slot w;
      w.show();
      return a.exec();
  }
  </code></pre>
  
  <p><strong>ui_QtSignal_Slot.h</strong></p>
  
  <pre><code>#ifndef UI_QTSIGNAL_SLOT_H
  #define UI_QTSIGNAL_SLOT_H
  
  #include &lt;QtCore/QVariant&gt;
  #include &lt;QtWidgets/QAction&gt;
  #include &lt;QtWidgets/QApplication&gt;
  #include &lt;QtWidgets/QButtonGroup&gt;
  #include &lt;QtWidgets/QGridLayout&gt;
  #include &lt;QtWidgets/QHeaderView&gt;
  #include &lt;QtWidgets/QLineEdit&gt;
  #include &lt;QtWidgets/QMainWindow&gt;
  #include &lt;QtWidgets/QMenuBar&gt;
  #include &lt;QtWidgets/QPushButton&gt;
  #include &lt;QtWidgets/QSpacerItem&gt;
  #include &lt;QtWidgets/QStatusBar&gt;
  #include &lt;QtWidgets/QTextEdit&gt;
  #include &lt;QtWidgets/QToolBar&gt;
  #include &lt;QtWidgets/QWidget&gt;
  
  QT_BEGIN_NAMESPACE
  
  class Ui_QtSignal_SlotClass
  {
  public:
      QWidget *centralWidget;
      QGridLayout *gridLayout;
      QPushButton *ButtonStart;
      QSpacerItem *horizontalSpacer_2;
      QSpacerItem *horizontalSpacer_4;
      QTextEdit *textEdit;
      QSpacerItem *verticalSpacer_2;
      QSpacerItem *verticalSpacer_3;
      QSpacerItem *horizontalSpacer;
      QSpacerItem *horizontalSpacer_3;
      QLineEdit *PathEdit;
      QMenuBar *menuBar;
      QToolBar *mainToolBar;
      QStatusBar *statusBar;
  
      void setupUi(QMainWindow *QtSignal_SlotClass)
      {
          if (QtSignal_SlotClass-&gt;objectName().isEmpty())
              QtSignal_SlotClass-&gt;setObjectName(QStringLiteral("QtSignal_SlotClass"));
          QtSignal_SlotClass-&gt;setEnabled(true);
          QtSignal_SlotClass-&gt;resize(380, 250);
          QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
          sizePolicy.setHorizontalStretch(0);
          sizePolicy.setVerticalStretch(0);
          sizePolicy.setHeightForWidth(QtSignal_SlotClass-&gt;sizePolicy().hasHeightForWidth());
          QtSignal_SlotClass-&gt;setSizePolicy(sizePolicy);
          QtSignal_SlotClass-&gt;setMinimumSize(QSize(380, 250));
          QtSignal_SlotClass-&gt;setMaximumSize(QSize(700, 300));
          QtSignal_SlotClass-&gt;setSizeIncrement(QSize(400, 250));
          QtSignal_SlotClass-&gt;setBaseSize(QSize(200, 250));
          centralWidget = new QWidget(QtSignal_SlotClass);
          centralWidget-&gt;setObjectName(QStringLiteral("centralWidget"));
          gridLayout = new QGridLayout(centralWidget);
          gridLayout-&gt;setSpacing(6);
          gridLayout-&gt;setContentsMargins(11, 11, 11, 11);
          gridLayout-&gt;setObjectName(QStringLiteral("gridLayout"));
          ButtonStart = new QPushButton(centralWidget);
          ButtonStart-&gt;setObjectName(QStringLiteral("ButtonStart"));
          ButtonStart-&gt;setStyleSheet(QStringLiteral("background-color: rgb(200,200,255); color: rgb(0,0,0);"));
  
          gridLayout-&gt;addWidget(ButtonStart, 7, 1, 1, 1);
  
          horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  
          gridLayout-&gt;addItem(horizontalSpacer_2, 7, 2, 1, 1);
  
          horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  
          gridLayout-&gt;addItem(horizontalSpacer_4, 0, 2, 1, 1);
  
          textEdit = new QTextEdit(centralWidget);
          textEdit-&gt;setObjectName(QStringLiteral("textEdit"));
          textEdit-&gt;setStyleSheet(QStringLiteral("color: rgb(0,0,0);"));
  
          gridLayout-&gt;addWidget(textEdit, 3, 1, 1, 1);
  
          verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
  
          gridLayout-&gt;addItem(verticalSpacer_2, 1, 1, 1, 1);
  
          verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
  
          gridLayout-&gt;addItem(verticalSpacer_3, 2, 1, 1, 1);
  
          horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  
          gridLayout-&gt;addItem(horizontalSpacer, 7, 0, 1, 1);
  
          horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  
          gridLayout-&gt;addItem(horizontalSpacer_3, 0, 0, 1, 1);
  
          PathEdit = new QLineEdit(centralWidget);
          PathEdit-&gt;setObjectName(QStringLiteral("PathEdit"));
          QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
          sizePolicy1.setHorizontalStretch(0);
          sizePolicy1.setVerticalStretch(0);
          sizePolicy1.setHeightForWidth(PathEdit-&gt;sizePolicy().hasHeightForWidth());
          PathEdit-&gt;setSizePolicy(sizePolicy1);
          PathEdit-&gt;setMinimumSize(QSize(200, 30));
          PathEdit-&gt;setStyleSheet(QStringLiteral("background-color: rgb(240,240,240); color: rgb(0,0,0);"));
  
          gridLayout-&gt;addWidget(PathEdit, 0, 1, 1, 1);
  
          QtSignal_SlotClass-&gt;setCentralWidget(centralWidget);
          menuBar = new QMenuBar(QtSignal_SlotClass);
          menuBar-&gt;setObjectName(QStringLiteral("menuBar"));
          menuBar-&gt;setGeometry(QRect(0, 0, 380, 21));
          QtSignal_SlotClass-&gt;setMenuBar(menuBar);
          mainToolBar = new QToolBar(QtSignal_SlotClass);
          mainToolBar-&gt;setObjectName(QStringLiteral("mainToolBar"));
          QtSignal_SlotClass-&gt;addToolBar(Qt::TopToolBarArea, mainToolBar);
          statusBar = new QStatusBar(QtSignal_SlotClass);
          statusBar-&gt;setObjectName(QStringLiteral("statusBar"));
          QtSignal_SlotClass-&gt;setStatusBar(statusBar);
  
          retranslateUi(QtSignal_SlotClass);
  
          QMetaObject::connectSlotsByName(QtSignal_SlotClass);
      } // setupUi
  
      void retranslateUi(QMainWindow *QtSignal_SlotClass)
      {
          QtSignal_SlotClass-&gt;setWindowTitle(QApplication::translate("QtSignal_SlotClass", "QtSignal_Slot", Q_NULLPTR));
          ButtonStart-&gt;setText(QApplication::translate("QtSignal_SlotClass", "Generate graphicfile", Q_NULLPTR));
          PathEdit-&gt;setText(QString());
      } // retranslateUi
  
  };
  
  namespace Ui {
      class QtSignal_SlotClass: public Ui_QtSignal_SlotClass {};
  } // namespace Ui
  
  QT_END_NAMESPACE
  
  #endif // UI_QTSIGNAL_SLOT_H
  </code></pre>
  
  <p><strong>QtSignal_Slot.h</strong></p>
  
  <pre><code>#pragma once
  
  #include &lt;QtWidgets/QMainWindow&gt;
  #include "ui_QtSignal_Slot.h"
  
  class QtSignal_Slot : public QMainWindow
  {
      Q_OBJECT
  
  public:
      QString m_Path;
  
      QtSignal_Slot(QWidget *parent = Q_NULLPTR);
  
  public slots:
      void m_StartButtonpressed();
  
  private:
      Ui::QtSignal_SlotClass ui;
  };
  </code></pre>
  
  <p><strong>QtSolts_Signel.cpp</strong></p>
  
  <pre><code>#include "QtSignal_Slot.h"
  #include &lt;ui_QtSignal_Slot.h&gt;
  #include &lt;QDirIterator&gt;
  #include &lt;QDebug&gt;
  
  QtSignal_Slot::QtSignal_Slot(QWidget *parent) : QMainWindow(nullptr)
  {
      ui.setupUi(this);
      connect(ui.ButtonStart, SIGNAL(clicked()), this, SLOT(m_StartButtonpressed()));
  }
  
  void QtSignal_Slot::m_StartButton()
  {
      m_Path = (ui.PathEdit-&gt;text());
  
      QDirIterator it(m_Path, QStringList() &lt;&lt; "*.cpp" , QDir::Files, QDirIterator::Subdirectories);
  
      do
      {
          qDebug() &lt;&lt; it.next();
  
      } while (it.hasNext());
  
      qDebug() &lt;&lt; "This, show in the Output";
      QString Buffer = QString("%1").arg(QString::number(it.hasNext()));
      ui.textEdit-&gt;setText(Buffer +"-&gt;" + it.filePath() + "&lt;-" + m_Path);
  }
  </code></pre>
  
  <p>The output in the textEdit is:</p>
  
  <blockquote>
    <p>"0-> &lt;-(correct path i but i as input)"</p>
  </blockquote>
  
  <p>and output in the debug-output is:</p>
  
  <blockquote>
    <p>" ' ' , This, show in the Output"</p>
  </blockquote>
  
  <p>The code is updated, but the problem stays.</p>