I am using QNetworkAccessManager to download data and add to database but device (e5) very hot when use..
I do not know why
help me...
example:
nam = new QNetworkAccessManager(parent);
// new line
Initialize();
QObject::connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleNetworkReply(QNetworkReply*)));
void NetworkApi:ownLoadCatalouge()
{
QObject::connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleNetworkReply(QNetworkReply*)));
isDownloadCatalouge=true;
QNetworkRequest request(QUrl("http://apps.imark.com.vn:8080/MobileWsFC/FCProductCatalougeWS.asmx/getAll"));
QByteArray data;
data.remove(0,1);
nam->post(request,data);
}
void NetworkApi::handleNetworkReply(QNetworkReply* reply)
{
disconnect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleNetworkReply(QNetworkReply*)));
//QVariant statusCodeV = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
// no error received?
if (reply->error() == QNetworkReply::NoError)
{
QString stringXML(reply->readAll()); // raw xml
qDebug(QString("\n\n---------------\n").append(stringXML).toUtf8());
emit GetDataReceived(&stringXML);
}
else
{
}
reply->deleteLater();
Initialize();
}
void DownLoadCatalouge::showEvent(QShowEvent *)
{
ui->label->setText("Dang tai du lieu loai san pham, vui long doi...");
ui->label_2->setText("");
if(dbMag->DeleteTableCatalouge())
{
connect(networkApi,SIGNAL(commError(QString*)),this,SLOT(NetworkError(QString*)));
connect(networkApi,SIGNAL(GetDataReceived(QString*)),this,SLOT(ProcessDownLoadCatalouge(QString*)));
networkApi->DownLoadCatalouge();
// connect(networkApi,SIGNAL(DownLoadCatalougeReceived(QString*)),this,SLOT(ProcessDownLoadCatalouge(QString*)));
}
else
{
QMessageBox::warning(this,tr("Thông Báo"),"Loi xoa du lieu loai san pham cu");
}
}
void DownLoadCatalouge::ProcessDownLoadCatalouge(QString *xmlData)
{
disconnect(networkApi,SIGNAL(commError(QString*)),this,SLOT(NetworkError(QString*)));
disconnect(networkApi,SIGNAL(GetDataReceived(QString*)),this,SLOT(ProcessDownLoadCatalouge(QString*)));
QDomDocument xml("ICamera_Response_downloadCatalouge");
xml.setContent(*xmlData);
QDomElement rootNode = xml.documentElement();
QString akjsdh= rootNode.nodeName();
if(rootNode.nodeName()=="ArrayOfBizProductCatalouge")
{
QDomNode rootNode1=rootNode.firstChild();
while(!rootNode1.isNull())
{
QString caID=rootNode1.firstChild().firstChild().nodeValue();
QString nameCata=rootNode1.firstChild().nextSibling().firstChild().nodeValue();
QString isDoiThu=rootNode1.firstChild().nextSibling().nextSibling().firstChild().nodeValue();
if(caID!="" && nameCata!="" && isDoiThu!="")
{
int bCheck =dbMag->AddNewCatalouge(caID,nameCata,isDoiThu);
if(bCheck==-1)
{
QMessageBox::warning(this,tr("Thông Báo"),"Loi Insert Catalouge");
}
}
rootNode1=rootNode1.nextSibling();
}
result="Tai thanh cong loai du lieu";
//disconnect(networkApi,SIGNAL(DownLoadCatalougeReceived(QString*)),this,SLOT(ProcessDownLoadCatalouge(QString*)));
}
else
{
result="Tai khong thanh cong loai du lieu";
}

ownLoadCatalouge()


