title: Qt - No matching function to call to connect
body: <p>I have this error when I tried to call connect.</p>
  
  <blockquote>
    <p>E:\GraphTool\graphscene.cpp:7: error: no matching function for call to 'GraphScene::connect(QObject*&amp;, void (MainWindow::<em>)(Mode), GraphScene</em>, void (GraphScene::*)(Mode))'
         QObject::connect(parent, &amp;MainWindow::changedMode, this, &amp;GraphScene::setMode);</p>
  </blockquote>
  
  <p>I called connect in graphscene.cpp</p>
  
  <pre><code>    GraphScene::GraphScene(QObject *parent) : QGraphicsScene (parent), mode(NAV) {
          QObject::connect(parent, &amp;MainWindow::changedMode, this, &amp;GraphScene::setMode);
      }
  </code></pre>
  
  <p>The GraphScene class : </p>
  
  <pre><code>class GraphScene : public QGraphicsScene {
      Q_OBJECT
  public:
      GraphScene(QObject *);
      void mousePressEvent(QGraphicsSceneMouseEvent*);
  
  public slots:
      void setMode(Mode m);
  
  private:
      Mode mode;
  }
  </code></pre>
  
  <p>The MainWindow class :</p>
  
  <pre><code>class MainWindow : public QMainWindow {
      Q_OBJECT
  
  public:
      explicit MainWindow(QWidget *parent = nullptr);
      ~MainWindow();
  
  public slots:
      void actionTriggered(QAction *action);
  
  signals:
      void changedMode(Mode newMode);
  
  private:
      Ui::MainWindow *ui;
      QActionGroup* modesGroup;
      GraphScene *scene;
  };
  </code></pre>
  
  <p>I emit the signal here, I don't know if that have anything to do with it : </p>
  
  <pre><code> void MainWindow::actionTriggered(QAction *action){
      QString actionText = action-&gt;text() ;
      if(actionText == "Navigation"){
          emit changedMode(NAV);
      }
      else if (actionText == "Add node") {
          emit changedMode(ADD_NODE);
      }
      else if (actionText == "Delete node") {
          emit changedMode(DEL_NODE);
      }
  }
  </code></pre>
  
  <p>I found many other answers on SO related but I couldn't fix it. Most tell to check for QObject inheritance and Q_OBJECT macro. </p>