rsslisting example: rename a slot to reflect what it does
Many slots can be connected to one signal so, unlike a virtual method that must be named for the situation in which it is called, a slot can (so should) be named for what it does, rather than naming it to match the signal it's connected to. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: If2fa40cac0e51a243054526d7d2997fdd54aea3e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
This commit is contained in:
parent
fe2af0f8a3
commit
3c78f1e96e
@ -76,7 +76,7 @@ void RSSListing::get(const QUrl &url)
|
||||
}
|
||||
currentReply = url.isValid() ? manager.get(QNetworkRequest(url)) : nullptr;
|
||||
if (currentReply) {
|
||||
connect(currentReply, &QNetworkReply::readyRead, this, &RSSListing::readyRead);
|
||||
connect(currentReply, &QNetworkReply::readyRead, this, &RSSListing::consumeData);
|
||||
connect(currentReply, &QNetworkReply::errorOccurred, this, &RSSListing::error);
|
||||
}
|
||||
xml.setDevice(currentReply); // Equivalent to clear() if currentReply is null.
|
||||
@ -112,7 +112,7 @@ void RSSListing::fetch()
|
||||
stream reader. Then we call the XML parsing function.
|
||||
*/
|
||||
|
||||
void RSSListing::readyRead()
|
||||
void RSSListing::consumeData()
|
||||
{
|
||||
int statusCode = currentReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
if (statusCode >= 200 && statusCode < 300)
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
public slots:
|
||||
void fetch();
|
||||
void finished(QNetworkReply *reply);
|
||||
void readyRead();
|
||||
void consumeData();
|
||||
void error(QNetworkReply::NetworkError);
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user