I'm trying to implement a custom class of QTcpSocket
but it seems that my slots are not recognized at run time
I always get:
Object::connect: No such slot QTcpSocket::timeoutSlot()
Here is my code:
my header:
#ifndef CUSTOM_SOCKET_H
#define CUSTOM_SOCKET_H
#include <QTcpSocket>
#include <QTimer>
class CustomSocket : public QTcpSocket {
Q_OBJECT
public:
CustomSocket(QObject* = 0);
private:
QTimer *mAuthTimeout;
public slots:
void timeoutSlot();
};
#endif
Implementation:
#include "customSocket.h"
CustomSocket::CustomSocket(QObject *aParent):QTcpSocket(aParent)
{
mAuthTimeout = new QTimer();
connect(mAuthTimeout, SIGNAL(timeout()), this, SLOT(timeoutSlot()));
mAuthTimeout->start(5000);
}
void CustomSocket::timeoutSlot(){
std::cout << "Timeout " << std::endl;
}