-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <QApplication> | ||
#include <QPlainTextEdit> | ||
#include <QNetworkAccessManager> | ||
#include <QNetworkRequest> | ||
#include <QNetworkReply> | ||
#include "../../qtnetworkng.h" | ||
|
||
using namespace qtng; | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
QApplication app(argc, argv); | ||
QSharedPointer<QPlainTextEdit> text(new QPlainTextEdit); | ||
text->show(); | ||
CoroutineGroup operations; | ||
operations.spawn([text] { | ||
QNetworkAccessManager manager; | ||
QUrl url("http://download.qt.io/online/qt5/linux/x64/online_repository/Updates.xml"); | ||
QNetworkRequest request(url); | ||
QNetworkReply *reply = manager.get(request); | ||
qAwait(reply, &QNetworkReply::finished); | ||
text->setPlainText(reply->readAll()); | ||
reply->deleteLater(); | ||
}); | ||
return startQtLoop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
###################################################################### | ||
# Automatically generated by qmake (3.1) Tue May 29 08:36:34 2018 | ||
###################################################################### | ||
|
||
TEMPLATE = app | ||
QT+= widgets network | ||
TARGET = using_iodevice | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
SOURCES += main.cpp | ||
include(../../qtnetworkng.pri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters