7#include <QtCore/qsharedpointer.h>
8#include <QtCore/qtypeinfo.h>
19 static_assert(!std::is_pointer<T>::value,
"QPointer's template type must not be a pointer type");
22 using if_convertible = std::enable_if_t<std::is_convertible_v<X*, T*>,
bool>;
37 template <
typename X, if_convertible<X> = true>
40 : wp(std::exchange(
other.wp,
nullptr).internalData(),
true) {}
41 template <
typename X, if_convertible<X> = true>
44 : wp(
other.wp.internalData(),
true) {}
54 { wp.assign(
static_cast<QObjectType*
>(
p));
return *
this; }
57 {
return static_cast<T*
>(wp.internalData()); }
64 inline operator T*()
const
73#define DECLARE_COMPARE_SET(T1, A1, T2, A2) \
74 friend bool operator==(T1, T2) \
75 { return A1 == A2; } \
76 friend bool operator!=(T1, T2) \
79#define DECLARE_TEMPLATE_COMPARE_SET(T1, A1, T2, A2) \
80 template <typename X> \
81 friend bool operator==(T1, T2) noexcept \
82 { return A1 == A2; } \
83 template <typename X> \
84 friend bool operator!=(T1, T2) noexcept \
92#undef DECLARE_COMPARE_SET
93#undef DECLARE_TEMPLATE_COMPARE_SET
void swap(QPixmap &other) noexcept
QPointer< T > & operator=(T *p)
Assignment operator.
void swap(QPointer &other) noexcept
T & operator*() const
Dereference operator; implements pointer semantics.
Q_NODISCARD_CTOR QPointer()=default
Q_NODISCARD_CTOR QPointer(T *p)
Constructs a guarded pointer that points to the same object that p points to.
Q_NODISCARD_CTOR QPointer(const QPointer< X > &other) noexcept
T * operator->() const
Overloaded arrow operator; implements pointer semantics.
Q_NODISCARD_CTOR QPointer(QPointer< X > &&other) noexcept
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
void clear()
Clears this QWeakPointer object, dropping the reference that it may have had to the pointer.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void swap(QWeakPointer &other) noexcept
Combined button and popup list for selecting options.
Q_CORE_EXPORT QWeakPointer< QObject > weakPointerFromVariant_internal(const QVariant &variant)
static ControlElement< T > * ptr(QWidget *widget)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define DECLARE_TEMPLATE_COMPARE_SET(T1, A1, T2, A2)
QPointer< T > qPointerFromVariant(const QVariant &variant)
#define DECLARE_COMPARE_SET(T1, A1, T2, A2)
#define Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS)
static T * internalData(const QWeakPointer< T > &p) noexcept