No matching function for QObject::connect

There can be several reasons for the issue in general:

  • You do not inherit QObject.

  • You do not have the Q_OBJECT macro in your class.

  • You do not define the method as slot in your header file where the class is declared.

Your issue is the first which can be seen here:

class clientSupervision

You should change your code to:

class clientSupervision : public QObject
//                      ^^^^^^^^^^^^^^^^

Of course, the constructor implementation and signature would need to change, too, as follows:

explicit clientSupervision(QObject *parent = Q_NULL_PTR) : QObject(parent) { ... }

In addition, you seem to leak your QTimer instance as it does not get the parent as a parameter to the constructor.

Furthermore, the QObject:: scope is needless in your code as your class ought to inherit QObject directly or indirectly either way.

Even more, I would highly encourage you to utilize the new signal-slot syntax.


Another possible cause of this error is trying to connect to a slot which is overloaded. For example, this well cause the same error

QObject::connect(this,
                 &MazeWidget::MyUpdate,
                 this, 
                 &QWidget::update,
                 Qt::QueuedConnection);

But not if you explicitely cast:

QObject::connect(this,
                 &MazeWidget::MyUpdate,
                 this,
                 static_cast<void (QWidget::*)()>(&QWidget::update),
                  Qt::QueuedConnection);

Here's another one that snuck up on me: The class of the slot object had been forward declared in the header, but not defined in the implementation by including its header.