1

I've this code snippet:

class Server{
public slot:
    static void readMessage();
};

// somewhere in the main code...
connect(tcpsocket, &QTcpSocket::readyRead, Server::readMessage);

error: no matching function for call to 'QObject::connect(const Object*&, void (QIODevice::&)(), const Object&, void (Server::*&)(), Qt::ConnectionType)' return connect(sender, signal, sender, slot, Qt::DirectConnection);

I don't know how to deal with that.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
cg f
  • 41
  • 1
  • 5

1 Answers1

0

Try this:

connect( tcpsocket, &QTcpSocket::readyRead, [](){ Server::readMessage(); });

Note: This will need C++11 compiler features.

PRIME
  • 1,058
  • 7
  • 21