Is it possible to disconnect a lambda function? And if "yes", how?
According to https://qt-project.org/wiki/New_Signal_Slot_Syntax I need to use a QMetaObject::Connection
which is returned from the QObject::connect method, but then how can I pass that object to the lambda function?
Pseudo-code example:
QMetaObject::Connection conn = QObject::connect(m_sock, &QLocalSocket::readyRead, [this](){
QObject::disconnect(conn); //<---- Won't work because conn isn't captured
//do some stuff with sock, like sock->readAll();
}