Hey there, I'm completely new to this forum! I'm coming here because I'm having an issue in my Qt code, and my beginner skills aren't helping me a lot...
I'm trying to send a request to get the content of a tumblr blog, at "kauritree.tumblr.com/api/read". The file I should get is an XML file, so I created a class that is in charge of downloading the file, and transforming it in whatever I want. I just cant get the QNetworkAccessManager.get(request) to be working... and I dont know why. The GET request is not even sent (I checked using Wireshark)... Thank you for your help!
here is my code:
main.cpp:
qUrl.setUrl("http://kauritree.tumblr.com/api/read/");
ListeXml listeXml;
listeXml.downloadd(qUrl);
QUrl qUrl;
qUrl.setUrl("http://kauritree.tumblr.com/api/read/");
ListeXml listeXml;
listeXml.downloadd(qUrl);
To copy to clipboard, switch view to plain text mode
my ListeXml.cpp
ListeXml
::ListeXml(QObject *parent
) :{
}
{
DownloadManager manager;
manager.doDownload(url.toString());
}
ListeXml::ListeXml(QObject *parent) :
QObject(parent)
{
}
QString ListeXml::downloadd(QUrl url)
{
DownloadManager manager;
manager.doDownload(url.toString());
}
To copy to clipboard, switch view to plain text mode
DownloadManager.cpp
DownloadManager::DownloadManager() //Constructor
{
QObject::connect(&manager,
SIGNAL(finished
(QNetworkReply
*)),
SLOT(downloadFinished
(QNetworkReply
*)));
}
void DownloadManager
::doDownload(QString Url
) {
url.setUrl(Url);
const QNetworkRequest request(url);
QNetworkReply *reply = manager.get(request);
}
DownloadManager::DownloadManager() //Constructor
{
QObject::connect(&manager, SIGNAL(finished(QNetworkReply*)),SLOT(downloadFinished(QNetworkReply*)));
}
void DownloadManager::doDownload(QString Url)
{
QUrl url;
url.setUrl(Url);
const QNetworkRequest request(url);
QNetworkReply *reply = manager.get(request);
}
To copy to clipboard, switch view to plain text mode
Bookmarks