title: QLineEdit: controlling the input validation while the input is being provided
body: <p>I need to control the input that is being provided through a <code>QLineEdit</code>. The provided input will be checked to see if it meets certain criteria (i.e. particular letters, digits and symbols constraints)</p>
  
  <p><strong>Tasks:</strong> </p>
  
  <ol>
  <li>This checking procedure has to be done when the user is providing input. </li>
  <li>Due to the mismatch with the constraint list, a message should pop-up to notify the user.</li>
  </ol>
  
  <p>My Problem: I only can see how to check the text after the user presses any pushbutton while my goal is to check the input while it is being provided and not have to wait until the button is pressed. </p>
  
  <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  
  #include &lt;QMainWindow&gt;
  #include &lt;QString&gt;
  
  namespace Ui {
  class MainWindow;
  }
  
  class MainWindow : public QMainWindow
  {
      Q_OBJECT
  
  public:
      explicit MainWindow(QWidget *parent = 0);
      ~MainWindow();
  
  private slots:
      void on_pushButton_clicked();
  
  private:
      Ui::MainWindow *ui;
  };
  
  #endif // MAINWINDOW_H
  
  
  
  #include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QMessageBox&gt;
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::on_pushButton_clicked()
  {
      QString reg_exp("!§$%&amp;/(){}[]=?\ß`*+~#'.,;-@");
      int flag = 0;
  
      QString str = ui-&gt;lineEdit-&gt;text();
  
  
      for(int i = 0; i &lt; str.length(); ++i)
      {
           for(int j = 0; j &lt; reg_exp.length(); ++j )
           {
                if(str[i] == reg_exp[j])
                flag = 1;
           }
           if (flag == 1)
           {
              QMessageBox::warning(this,"Check","Its a mismatch!");
               break;
           }
      }
  }
  </code></pre>