1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #include "classe.h"
classe::classe() {
QObject::connect(&req, SIGNAL(done(bool)), this, SLOT(affiche(bool)));
QObject::connect(&req, SIGNAL(requestFinished(int, bool)), this, SLOT(fin(int, bool)));
req.setHost("eu.wowarmory.com");
QHttpRequestHeader header("POST","http://eu.wowarmory.com/character-sheet.xml?r=Dalaran&n=Unicorniste");
header.setValue("Host","eu.wowarmory.com");
header.setValue("User-Agent","Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14");
req.request(header);
show();
}
void classe::fin(int _id, bool _error) {
if(_error)
QMessageBox::information(0, "Fin", QString().setNum(req.error()));
}
void classe::affiche(bool) {
setText(QString(req.readAll().data()));
} |
Partager