![]() |
CopperSpice API
2.0.0
|
Contains a pointer to a QObject. More...
Public Methods | |
QPointer () | |
QPointer (const QPointer &other) = default | |
QPointer (QPointer &&other) = default | |
QPointer (T *ptr) | |
~QPointer () = default | |
void | clear () |
T * | data () const |
bool | isNull () const |
operator T * () const | |
bool | operator!= (const QPointer &other) const |
bool | operator!= (const T *ptr) const |
T & | operator* () const |
T * | operator-> () const |
QPointer & | operator= (const QPointer &other) = default |
QPointer & | operator= (QPointer &&other) = default |
QPointer< T > & | operator= (T *ptr) |
bool | operator== (const QPointer< T > &other) const noexcept |
bool | operator== (const T *ptr) const |
The QPointer class contains a pointer which can only point to a QObject or a child of QObject. The internal pointer is very similar to a weak pointer. However, there is no reference count in a QPointer, it is maintained in the QObject class. When a QObject or a class which inherits from QObject is deleted this class will contain a nullptr.
QPointer can never be used in a thread safe manner and should only be used in single threaded applications. From multi-threaded applications use a QSharedPointer with a QWeakPointer.
|
inline |
Constructs QPointer which contains a null pointer.
|
inlineexplicit |
Constructs a QPointer which points to the same object which ptr points to. The template parameter T must inherit from QObject.
|
default |
Destroys the pointer.
|
default |
Copy constructs a new QPointer from other.
|
default |
Move constructs a new QPointer from other.
|
inline |
Sets the current QPointer object to a null pointer.
|
inline |
Returns a raw pointer to the current object. The template parameter T must inherit from QObject.
|
inline |
Returns true if the referenced object has been destroyed or if there is no referenced object, otherwise returns false.
|
inline |
This method converts a QPointer to a raw pointer.
bool QPointer< T >::operator!= | ( | const QPointer< T > & | other | ) | const |
Returns true if this QPointer is not equal to other, otherwise returns false.
bool QPointer< T >::operator!= | ( | const T * | ptr | ) | const |
Returns true if this QPointer is not equal to ptr, otherwise returns false.
|
inline |
Dereferences this QPointer and returns the object it points to. If the QPointer is a nullptr the behavior is undefined.
|
inline |
Dereferences this QPointer and returns a raw pointer to the object it points to. If the QPointer is a nullptr the behavior is undefined.
|
default |
Copy assigns from other and returns a reference to this object.
|
default |
Move assigns from other and returns a reference to this object.
|
inline |
Assigns ptr to this QPointer.
|
inlinenoexcept |
Returns true if this QPointer is equal to other, otherwise returns false.
bool QPointer< T >::operator== | ( | const T * | ptr | ) | const |
Returns true if this QPointer is equal to ptr, otherwise returns false.