diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2023-04-28 15:14:04 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2023-04-29 20:22:39 +0000 |
| commit | 5f28d367d999842a42fa0afa0d36d44ff61ea11d (patch) | |
| tree | f3384eb7a1273cf5b8d2e222b4458a2ac338896c /src/corelib/kernel/qpointer.cpp | |
| parent | 9b47c62682647a5a3a4119843a180e067952026f (diff) | |
Make QPointer<T> constructible from QPointer<X>
QWeakPointer can do the same, so there's no reason to not allow it for
QPointer.
[ChangeLog][QtCore][QPointer] QPointer<T> can now be (move- and
copy-)constructed from QPointer<X>.
Fixes: QTBUG-112464
Change-Id: I77cf5d39974bf2b3ec849b4afc33e286e864821e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib/kernel/qpointer.cpp')
| -rw-r--r-- | src/corelib/kernel/qpointer.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp index aebdd68428b..c884844db3a 100644 --- a/src/corelib/kernel/qpointer.cpp +++ b/src/corelib/kernel/qpointer.cpp @@ -98,6 +98,20 @@ */ /*! + \fn template <class T> template <class X> QPointer<T>::QPointer(QPointer<X> &&other) + \fn template <class T> template <class X> QPointer<T>::QPointer(const QPointer<X> &other) + \since 6.6 + + Conversion constructor. Constructs a new QPointer by moving or copying from + \a other. + + The moved-from QPointer is reset to nullptr. + + \note These constructors participate 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 |
