Connecting to QNetworkReply::error signal

You need manually to cast the function pointer to address the correct function:

connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &MyClass::error);

This is the noted consequence of using new syntax for overloaded functions:

cons:

Very complicated syntax in cases of overloads?

P.S. You can find similar example on the above link:

 QObject::connect(socket, static_cast<void (QTcpSocket::*)(QAbstractSocket::SocketError)>(&QAbstractSocket::error), [socket] (QAbstractSocket::SocketError) {
        qDebug()<< "ERROR " << socket->errorString();
        socket->deleteLater();
    });

Tags:

Qt

Qt5