本文整理汇总了C++中QNetworkReply::disconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkReply::disconnect方法的具体用法?C++ QNetworkReply::disconnect怎么用?C++ QNetworkReply::disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QNetworkReply
的用法示例。
在下文中一共展示了QNetworkReply::disconnect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: requestError
void Dialog::requestError(QNetworkReply::NetworkError error)
{
ui->requestlicense->setEnabled(true);
QNetworkReply* rep = qobject_cast<QNetworkReply*>(sender());
rep->disconnect();
rep->deleteLater();
QMessageBox::information(this, QString(), "Cannot connect to license server.");
}
示例2: requestFinished
void Dialog::requestFinished()
{
ui->requestlicense->setEnabled(true);
QNetworkReply* rep = qobject_cast<QNetworkReply*>(sender());
rep->disconnect();
rep->deleteLater();
QByteArray all = rep->readAll();
// qDebug() << all.constData();
QMessageBox::information(this, QString(), all.constData());
}
示例3: onRetroArchUpdateDownloadFinished
void MainWindow::onRetroArchUpdateDownloadFinished()
{
QNetworkReply *reply = m_updateReply.data();
QNetworkReply::NetworkError error;
int code;
m_updateProgressDialog->cancel();
/* At least on Linux, the progress dialog will refuse to hide itself and will stay on screen in a corrupted way if we happen to show an error message in this function. processEvents() will sometimes fix it, other times not... seems random. */
qApp->processEvents();
if (!reply)
return;
error = reply->error();
code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (m_updateFile.isOpen())
m_updateFile.close();
if (code != 200)
{
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));
RARCH_ERR("[Qt]: RetroArch update failed with HTTP status code: %d\n", code);
reply->disconnect();
reply->abort();
reply->deleteLater();
return;
}
if (error == QNetworkReply::NoError)
{
int index = m_updateFile.fileName().lastIndexOf(PARTIAL_EXTENSION);
QString newFileName = m_updateFile.fileName().left(index);
QFile newFile(newFileName);
/* rename() requires the old file to be deleted first if it exists */
if (newFile.exists() && !newFile.remove())
RARCH_ERR("[Qt]: RetroArch update finished, but old file could not be deleted.\n");
else
{
if (m_updateFile.rename(newFileName))
{
RARCH_LOG("[Qt]: RetroArch update finished downloading successfully.\n");
emit extractArchiveDeferred(newFileName);
}
else
{
RARCH_ERR("[Qt]: RetroArch update finished, but temp file could not be renamed.\n");
emit showErrorMessageDeferred(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE));
}
}
}
else
{
QByteArray errorArray = reply->errorString().toUtf8();
const char *errorData = errorArray.constData();
RARCH_ERR("[Qt]: RetroArch update ended prematurely: %s\n", errorData);
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": Code " + QString::number(code) + ": " + errorData);
}
reply->disconnect();
reply->close();
reply->deleteLater();
}