From the C++ side, QNetworkReply is not local in the sense that you get a pointer to a heap allocated object that lifetime you must handle yourself while outFile would a stack allocated object that would be destroyed at the end of the function.