I'm using Qt 5.4 and trying to resume accepting new connections when the "disconnected" signal from my QTcpSocket
is emitted. So I wrote the following in .h and .cpp file respectively:
QPointer<QTcpServer> tcpServer; // in .h file
connect(tcpSocket, &QAbstractSocket::disconnected, [=](){
tcpServer->resumeAccepting(); // in .cpp file
});
As you can see, I use QPointer
class for tcpSocket
. With the above codes, I'm not able to build my program and receive "no matching function for call to ..." error while I don't have any problem in case of defining tcpSocket
without QPointer
.
How should I solve this problem?
It would be smarter to do direct connection.
Please note that nextPendingConnection has parent set to
QTcpServer
, so you can also access server by: