Skip to content

Commit

Permalink
fix No such signal QNetworkReply::error
Browse files Browse the repository at this point in the history
in Macro Browser
  • Loading branch information
octaeder committed Dec 24, 2023
1 parent d46546b commit a7c6211
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/macrobrowserui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ MacroBrowserUI::MacroBrowserUI(QWidget *parent):QDialog (parent)

MacroBrowserUI::~MacroBrowserUI()
{
networkManager->deleteLater();
networkManager=nullptr;
if (networkManager) {
networkManager->deleteLater();
networkManager=nullptr;
}
foreach(QList<QTableWidgetItem *>lst,itemCache){
foreach(auto *item,lst){
delete item;
Expand Down Expand Up @@ -97,7 +99,11 @@ void MacroBrowserUI::requestMacroList(const QString &path,const bool &directURL)
request.setAttribute(AttributeURL,url);
QNetworkReply *reply = networkManager->get(request);
connect(reply, SIGNAL(finished()), SLOT(onRequestCompleted()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onRequestError()));
#if QT_VERSION_MAJOR<6
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onRequestError()));
#else
connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), SLOT(onRequestError()));
#endif
}

void MacroBrowserUI::itemClicked(QTableWidgetItem *item)
Expand Down Expand Up @@ -143,7 +149,7 @@ void MacroBrowserUI::onRequestError()
if (!reply) return;

QMessageBox::warning(this, tr("Browse macro repository"),
tr("Repository not found. Network error:%1").arg(reply->errorString()),
tr("Repository not found. Network error:%1").arg("\n"+reply->errorString()),
QMessageBox::Ok,
QMessageBox::Ok);
networkManager->deleteLater();
Expand Down

0 comments on commit a7c6211

Please sign in to comment.