title: Qt 5.3 Signals and Slots, Simple Function and Lambda Expression
body: <p>I tried to Write a program using Qt 5.3 and I try to using signals and slots as practice. I wrote the following code (part of the code) :</p>
  
  <pre><code>void exitToWin()
      {
          exit(0);
      }
  int main(int argc, char *argv[])
  {
  
      QApplication a(argc, argv);
      MainWindow w;
      QMessageBox EndBox;
      QObject::connect((EndBox.button(QMessageBox::Ok)),SIGNAL(clicked()),exitToWin);
      w.show();
      EndBox.show();
      return a.exec();
  }
  </code></pre>
  
  <p>I even change the declaration of the function to <code>static</code> and I checked the expression with parentheses and without them while I am writing the <code>connect</code> command. but although what Qt documented and what its IDE guided to. also I read <a href="https://stackoverflow.com/questions/17153029/qt-designer-how-to-connect-a-signal-to-a-static-function">here</a>  and I tested it.<br>
  Moreover I tried with lambda expression as below:</p>
  
  <pre><code>QObject::connect((EndBox.button(QMessageBox::Ok)),SIGNAL(clicked()),[=](){
      exit(0);
  });
  </code></pre>
  
  <p>but still I receive errors indicate "No matching function call".<br>
  And after all I have to say that I am using Microsoft Windows 7.</p>