title: QErrorMessage and QValidator
body: <p>I'm a student programmer and I'm trying to use some of the widgets provided in Qt to control my user input. I want the error message to display exactly whats wrong with the user input so I thought that using a switch statement would be best. I may not be correct about this and if there is a better way of doing this I am all ears! My main project will get allot of user input and it feels like there should be an easier way. The Qt Documentation lead me to believe that QValidator is at heart an enumerator data type. So I though I could use it in the switch statement however it doesn't seem to come up as an int. I'm not sure how to bring in an int value to make this work without defeating the intended convenience of the QValidator. </p>
  
  <p>Any info on how to make this work or do it better would be greatly appreciated. Thanks in advance.</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QValidator&gt;
  #include &lt;QErrorMessage&gt;
  #include &lt;QString&gt;
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      connect(ui-&gt;pushButtonValidate, SIGNAL(clicked()), this, SLOT(checkData()));
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::checkData()
  {
      QValidator *doubleValidator = new QDoubleValidator();
      switch(ui-&gt;lineEditValidate-&gt;setValidator(doubleValidator))
      {
      case 0:
          QErrorMessage *error0 = new QErrorMessage(this);
          error0-&gt;showMessage("The input is invalid");
          break;
      case 1:
          QErrorMessage *error1 = new QErrorMessage(this);
          error1-&gt;showMessage("The input is incomplete");
          break;
      case 2:
          break;
      default:
          QErrorMessage *error = new QErrorMessage(this);
          error-&gt;showMessage("No input");
      }
  }
  </code></pre>