Add clear() to QPointer for QWeakPointer compatibility.

Change-Id: I9efc162bf56775c7ebcff4e3b79a997edc4ceaeb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Stephen Kelly 2012-05-30 15:52:21 +02:00 committed by Qt by Nokia
parent 28dd6eda7b
commit 55d0c6c6cf
2 changed files with 13 additions and 0 deletions

View File

@ -170,6 +170,14 @@
there is no referenced object; otherwise returns false.
*/
/*!
\fn void QPointer::clear()
Clears this QPointer object.
\sa isNull()
*/
/*!
\fn T* QPointer::operator->() const

View File

@ -69,6 +69,9 @@ protected:
inline bool isNull() const
{ return wp.isNull(); }
inline void clear()
{ wp.clear(); }
};
template <class T>
@ -93,8 +96,10 @@ public:
{ return data(); }
#ifdef qdoc
inline bool isNull() const;
inline void clear() const;
#else
using QPointerBase::isNull;
using QPointerBase::clear;
#endif
};
template <class T> Q_DECLARE_TYPEINFO_BODY(QPointer<T>, Q_MOVABLE_TYPE);