diff options
Diffstat (limited to 'src/corelib/kernel')
| -rw-r--r-- | src/corelib/kernel/qpointer.cpp | 11 | ||||
| -rw-r--r-- | src/corelib/kernel/qpointer.h | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp index c884844db3a..e426c63ae5f 100644 --- a/src/corelib/kernel/qpointer.cpp +++ b/src/corelib/kernel/qpointer.cpp @@ -112,6 +112,17 @@ */ /*! + \fn template <class T> template <class X> QPointer<T> &QPointer<T>::operator=(const QPointer<X> &other) + \since 6.6 + + Conversion assignment operator. Makes this guarded pointer guard the + same object guarded by \a other. + + \note This operator participates in overload resolution only if \c{X*} + is convertible to \c{T*}. +*/ + +/*! \fn template <class T> void QPointer<T>::swap(QPointer &other) \since 5.6 diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h index 1914c45190a..7de159a535c 100644 --- a/src/corelib/kernel/qpointer.h +++ b/src/corelib/kernel/qpointer.h @@ -43,6 +43,13 @@ public: QPointer(const QPointer<X> &other) noexcept : wp(other.wp.internalData(), true) {} + template <typename X, if_convertible<X> = true> + QPointer &operator=(const QPointer<X> &other) + { + wp.assign(other.data()); + return *this; + } + #ifdef Q_QDOC // Stop qdoc from complaining about missing function ~QPointer(); |
