So the correct code would be like
void Manwindow::requestUpdates()
{
QNetworkmanager *NAM = new QNetworkManager();
// updateReply is declared publicly in the Mainwindow class (?)
updateReply = NAM.get( /* get Request stuff in here */ );
conect(updateReply, SIGNAL(finished()), this, SLOT(handleUpdateXML()));
}
void MainWindow::handleUpdateXML()
{
// Actions beng performed to read the XML data and so on...
updateReply->deleteLater();
}
void Manwindow::requestUpdates()
{
QNetworkmanager *NAM = new QNetworkManager();
// updateReply is declared publicly in the Mainwindow class (?)
updateReply = NAM.get( /* get Request stuff in here */ );
conect(updateReply, SIGNAL(finished()), this, SLOT(handleUpdateXML()));
}
void MainWindow::handleUpdateXML()
{
QString xml = QString::fromUTF8(updateReply->readAll());
// Actions beng performed to read the XML data and so on...
updateReply->deleteLater();
}
To copy to clipboard, switch view to plain text mode
Is it necessary to declare the QNetworkReply globally e.g. in the mainwindow-class or can it be defined locally too — does a updateReply->deleteLater(); prevent it to be deleted after leaving the procedure (as I learned it)?
Greets, Lukas
PS: thx for showing me the QObject::sender() opportunity, but I'll keep it working in separate procedures
Bookmarks