If you INSIST on using attributes, you can always do this:
class MyNetworkAccessManager : public QNetworkAccessManager {
public:
enum CustomAttribute { Attr1 = QNetworkRequest::User, Attr2 };
protected:
QNetworkReply
* createRequest
( Operation op,
const QNetworkRequest
& req,
QIODevice * outgoingData
= 0 ) { QNetworkReply *reply = QNetworkAccessManager::createRequest(op, req, outgoingData);
if(req.attribute(Attr1).isValid()) reply->setAttribute(Attr1, req.attribute(Attr1));
if(req.attribute(Attr2).isValid()) reply->setAttribute(Attr2, req.attribute(Attr2));
return reply;
}
};
class MyNetworkAccessManager : public QNetworkAccessManager {
public:
enum CustomAttribute { Attr1 = QNetworkRequest::User, Attr2 };
protected:
QNetworkReply * createRequest ( Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 ) {
QNetworkReply *reply = QNetworkAccessManager::createRequest(op, req, outgoingData);
if(req.attribute(Attr1).isValid()) reply->setAttribute(Attr1, req.attribute(Attr1));
if(req.attribute(Attr2).isValid()) reply->setAttribute(Attr2, req.attribute(Attr2));
return reply;
}
};
To copy to clipboard, switch view to plain text mode
... although I see no point in doing that. Attributes are there to mean something and not to provide storage for custom data. This is what dynamic properties are for.
Bookmarks