title: Qt Button with Id
body: <p>I wanted an extended button which holds an int as Id and can signal it out:</p>
  
  <p>Header:</p>
  
  <pre><code>#ifndef QPUSHBUTTONWITHID_H
  #define QPUSHBUTTONWITHID_H
  
  #include &lt;QPushButton&gt;
  #include &lt;QMessageBox&gt;
  
  class QPushButtonWithId : public QPushButton
  {
  public:
      QPushButtonWithId(int id);
      void setId(int id);
  
  protected:
      int Id;
      void mouseReleaseEvent(QMouseEvent *event);
  
  
  signals:
      void clicked(int);
  };
  
  #endif // QPUSHBUTTONWITHID_H
  </code></pre>
  
  <p>Cpp:</p>
  
  <pre><code>#include "qpushbuttonwithid.h"
  
  QPushButtonWithId::QPushButtonWithId(int id)
  {
      Id = id;
  }
  
  void QPushButtonWithId::setId(int id)
  {
      Id = id;
  }
  
  void QPushButtonWithId::mouseReleaseEvent(QMouseEvent *event)
  {
      emit clicked(Id);
  }
  </code></pre>
  
  <p>The compile error is: </p>
  
  <pre><code>C:\Qt\Qt5.2.0\Tools\QtCreator\bin\untitled\qpushbuttonwithid.cpp:15: error: undefined  reference to `QPushButtonWithId::clicked(int)'
  </code></pre>
  
  <p>How can I fix it?</p>