Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix No such signal QNetworkReply::error in Macro (Repository) Browser #3448

Merged
merged 1 commit into from
Dec 24, 2023

Conversation

octaeder
Copy link
Contributor

This PR fixes following in txs 4.7.2 current dev:

Disconnect from network
Open Macro Editor
Press Browse button to connect to repository. No data can be retrieved and expected message isn't shown:

grafik

Debug shows following message indicating why expected error message is missing:

qt.core.qobject.connect: QObject::connect: No such signal QNetworkReplyHttpImpl::error(QNetworkReply::NetworkError)

Looking at Qt’s online documentation for versions 5 and 6 we find the signal’s right name:

void errorOccurred(QNetworkReply::NetworkError code)

The connect is coded in macrobrowserui.cpp. A code search finds following in updatechecker.cpp:

#if QT_VERSION_MAJOR<6
        connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onRequestError(QNetworkReply::NetworkError)));
#else
        connect(reply, &QNetworkReply::errorOccurred,this, &UpdateChecker::onRequestError);
#endif

From Qt’s information I would conclude that the else path would suffice, but I keep it as is, since I can’t test Qt<6. So let’s see what update checker (from Config) shows:

grafik

Start changing macrobrowserui.cpp in a similar way:

#if QT_VERSION_MAJOR<6
    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onRequestError()));
#else
    connect(reply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), SLOT(onRequestError()));
#endif

The slots are used without arguments because it is declared in that way in macrobrowserui.h. On running this fix the expected message appears:

grafik

Be aware of the missing space after the colon. After adding a line break the text looks the same as for the update checker (s. above, no change of translations):

grafik

Press OK to close the message, Cancel to close Macro Browser and again Cancel to close Macro Editor. Now debug shows following message:

QCoreApplication::postEvent: Unexpected null receiver

This message appears only when the repository couldn’t be found. This is fixed in the destructor of the Macro Browser.

@sunderme sunderme merged commit 64fedc4 into texstudio-org:master Dec 24, 2023
5 checks passed
@sunderme
Copy link
Member

Thanks

@octaeder octaeder deleted the browseMacros branch December 25, 2023 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants