Qt signal slot connection - QNetworkAccessManager -
im new in qt , im trying understand following signal-slot connection:
m_networkmanager = new qnetworkaccessmanager(this); qnetworkreply *reply = m_networkmanager->get(request); connect(reply, signal(finished()),this, slot(onrequestcompleted()));
why connect "finished" signal after get-request?...what happened, if network connection in line-2 faster executed before slot connection (line-3) made?
i know, code work. want understand how possible :)
it's not possible finished() signal emit because haven't yielded event loop yet. if somehow request got sent , came back, code still executing , continue execute until you've yielded event loop. reply object ever chance anything, such parsing response , emitting corresponding signal.
Comments
Post a Comment