After years, but maybe helpfull. It is possible and makes possible to have one function with RETURN data. You can call it like:
QByteaArray array
= get_data
( QUrl url
);
QByteaArray array = get_data( QUrl url );
To copy to clipboard, switch view to plain text mode
so very nice
this works fine for me:
QNetworkReply* reply;
connect(networkManager, SIGNAL( finished( QNetworkReply* ) ), &connection_loop, SLOT( quit() ) );
networkRequest.setUrl( url );
qDebug() << "reaching url: " << url;
reply = networkManager->get( networkRequest );
connection_loop.exec();
qDebug() << "get -> " << url << ", done, size: " << reply->bytesAvailable();
reply->deleteLater();
return reply->readAll();
}
QByteArray gsm::data_request( QUrl url ){
QNetworkReply* reply;
QEventLoop connection_loop;
connect(networkManager, SIGNAL( finished( QNetworkReply* ) ), &connection_loop, SLOT( quit() ) );
networkRequest.setUrl( url );
qDebug() << "reaching url: " << url;
reply = networkManager->get( networkRequest );
connection_loop.exec();
qDebug() << "get -> " << url << ", done, size: " << reply->bytesAvailable();
reply->deleteLater();
return reply->readAll();
}
To copy to clipboard, switch view to plain text mode
so, it looks like you overloaded signal.
Bookmarks