How to connect overloaded signals with the new syntax in Qt5
Ok, imaging that you are working with Qt 5 and using the new way to connect signals, lets for example say we are working with QNetworkReply and we want to have a slot for the QNetworkReply::error signals that takes a QNetworkReply::NetworkError, the way to do it is the following:
1 2 3 4
connect(_reply, static_cast<void(QNetworkReply::*) (QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &MyClass::onNetworkError)
The static_cast is helping the compiler know what method (the signals or the actual method) you are talking about. I know, it is not nice at all but works at compile time better than getting a qWarning at runtime.
The problem is that without the help the compiler does not know what method error you are talking about :-/