title: Qt - no such signal error
body: <p>I'm trying to trigger a signal when a double click happens in one of the draggable widgets on the <a href="http://doc.qt.nokia.com/4.6/draganddrop-fridgemagnets.html" rel="noreferrer">fridge magnets example</a>. Here's the changes I made to the example source:</p>
  
  <p>DragLabel:</p>
  
  <pre><code>class DragLabel : public QLabel
  {
  public:
      DragLabel(const QString &amp;text, QWidget *parent);
      QString labelText() const;
  
  public slots:
      void testSlot(){qDebug()&lt;&lt;"testSlot";}    //&lt;-- implemented this slot
  
  protected:
      void mouseDoubleClickEvent(QMouseEvent *ev){emit testSignal();}    //&lt;-- overriden this method
  
  private:
      QString m_labelText;
  
  signals:
      void testSignal();    //&lt;-- added this signal
  
  };
  </code></pre>
  
  <p>The only thing I changed in the implementation file is adding <code>connect(this,SIGNAL(testSignal()),this,SLOT(testSlot()));</code> to DragLabel's constructor.</p>
  
  <p>Trying to compile the project resulted in '<em>undefined reference to `DragLabel::testSignal()</em>' and '<em>collect2: ld returned 1 exit status</em>' errors. </p>
  
  <p>When I comment out the call to the signal, it compiles and runs, but gives off '<em>Object::connect: No such signal QLabel::testSignal() in draglabel.cpp</em>' warning in the application output. Apparently testSignal() isn't being recognized as a signal.</p>
  
  <p>I've tried to add the Q_OBJECT macro to DragLabel but it results in 4 '<em>undefined reference to `vtable for DragLabel'</em>' warnings and a '<em>collect2: ld returned 1 exit status</em>' error.</p>
  
  <p>What am I missing?</p>