diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-10-09 10:03:42 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-10-09 10:04:00 (GMT) |
commit | 606e1150e381e0d824e6850befb101a2ed8e0542 (patch) | |
tree | 10a180b6e8013a22e7937f9c78d9636573d7ec83 /src/network/access/qnetworkrequest.cpp | |
parent | 62e7e63779a8dbd5dec16e5eb938bf597bc22548 (diff) | |
download | Qt-606e1150e381e0d824e6850befb101a2ed8e0542.zip Qt-606e1150e381e0d824e6850befb101a2ed8e0542.tar.gz Qt-606e1150e381e0d824e6850befb101a2ed8e0542.tar.bz2 |
Add a way to allow tracking the originating object with QNetworkRequest.
Added setOriginatingObject() and originatingObject() to QNetworkRequest
that internally tracks the QObject using a QWeakPointer.
Reviewed-by: Lars Knoll
Rubberstamped-by: Thiago
Diffstat (limited to 'src/network/access/qnetworkrequest.cpp')
-rw-r--r-- | src/network/access/qnetworkrequest.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index cde9858..ca9e606 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -481,6 +481,36 @@ void QNetworkRequest::setSslConfiguration(const QSslConfiguration &config) } #endif +/*! + \since 4.6 + + Allows setting a reference to the object initiating + the request. + + For example QtWebKit sets the originating object to the + QWebFrame that initiated the request. + + \sa originatingObject() +*/ +void QNetworkRequest::setOriginatingObject(QObject *object) +{ + d->originatingObject = object; +} + +/*! + \since 4.6 + + Returns a reference to the object that initiated this + network request; returns 0 if not set or the object has + been destroyed. + + \sa setOriginatingObject() +*/ +QObject *QNetworkRequest::originatingObject() const +{ + return d->originatingObject.data(); +} + static QByteArray headerName(QNetworkRequest::KnownHeaders header) { switch (header) { |