Why there's no QNetworkReply::error signal?
-
Hello.
The "documentation":http://doc-snapshot.qt-project.org/qt5-5.4/qnetworkreply.html#error-2 clearly says that there's a signal for QNetworkReply. I can't see it - in autocompletion there's only a function. Any attempt to connect to it results to compilation error.
-
when you provide some code and more probably infos (used Qt version, etc.) someone may be able to help you.
-
Sorry for confusion.
QtCreator 3.3.0 with Qt 5.4.0.
The code is:
@QObject::connect(&reply, static_cast<void(QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), &onReplyErrors);@Here onReplyErrors is a global function. On compilation I have:
bq. error: C2665: 'QObject::connect' : none of the 4 overloads could convert all the argument types
-
The "&" in front of reply and onReplyErrors bother me a little.
You usually get a pointer to QNetworkReply, not an instance of it so can you confirm you somehow got QNetworkReply object itself? Otherwise the first & shouldn't be there as it retrieves an address of a pointer, which is not good.
Also, if onReplyErrors is a free standing function you don't need the extra & there (although it's not technically an error).
-
[quote author="nikitablack" date="1422373746"]
Here onReplyErrors is a global function.
[/quote]
-You can only connect to non-static MEMBER functions (slots) of a QObject-derived CLASS-.
Nevermind, it's too early in the morning. ;) -
Chris Kawa, you're right. Thank you. My bad - I copypasted this line but didn't notice that reply is a pointer. And the lack of this signal in autocompletion confused me.