title: Qt 5 assign slot with parameters to a QPushButton
body: <p>I have a Qt application on C++ and I want to assign a slot to a QPushButton. But I want to pass some arguments because I have more than one QPushButton doing similar thing so I want one function but with a parameter in it but Qt keeps saying me that there is no slot like this. Can someone tell me why and how should I do it?</p>
  
  <p>Thank you in advance</p>
  
  <p>In the .h file I have: (it was private in the beginning but I changed it in searching of the problem)</p>
  
  <pre><code>public slots:
      void handleButton(int row, int col);
  </code></pre>
  
  <p>Then in the .cpp:</p>
  
  <pre><code>void fieldWindow::handleButton(int row, int col){
      cout &lt;&lt; row &lt;&lt; " " &lt;&lt; col &lt;&lt; endl;
  }
  </code></pre>
  
  <p>And again in the same .cpp:</p>
  
  <pre><code>connect(this-&gt;buttonsField[i][j], SIGNAL(released()), this, SLOT(handleButton(i,j)));
  </code></pre>
  
  <p>This is done in two nested loop so <code>i</code> and  <code>j</code> are well defined.</p>
  
  <p>And my error is: </p>
  
  <pre><code>QObject::connect: No such slot fieldWindow::handleButton(i,j) in ..\Proj1\fieldwindow.cpp:41
  QObject::connect:  (receiver name: 'fieldWindow')
  </code></pre>
  
  <p>I read something in the internet that I should say <code>handleButton(int, int);</code> but then how should I pass the arguments ?</p>