folgender Code:
Code: Alles auswählen
#include "testapp.h"
#include <QtGui>
#include <QtCore>
#include <QHttp>
void TestApp::httpRequestFinished(int requestId, bool error){
qDebug() << "finished";
if (httpRequestAborted){
qDebug() << "Request Aborted";
return;
}
if (requestId != httpGetId){
qDebug() << "Wrong Request ID";
return;
}
if (error){
QMessageBox::information(this, tr("HTTP"),tr("Download failed: %1.").arg(http->errorString()));
}
else{
qDebug() << "geladen";
}
}
TestApp::TestApp(QDialog *parent) : QDialog(parent)
{
setupUi(this);
http = new QHttp(this);
connect(okButton, SIGNAL (clicked()), this, SLOT(slotClose()));
connect(http, SIGNAL(requestFinished(int, bool)),this, SLOT(httpRequestFinished(int, bool)));
httpRequestAborted = false;
http->setHost("www.trolltech.com");
httpGetId = http->get("/index.html");
http->readAll();
qDebug() << "los gehts";
}
TestApp::~TestApp()
{}
void TestApp::slotClose()
{
accept();
}
Danke,
J.