QGIS API Documentation 3.43.0-Master (3ee7834ace6)
|
Keeps a pointer to an object owned by a QObject parent, and deletes it whenever this parent object is deleted. More...
#include <qobjectuniqueptr.h>
Public Member Functions | |
QObjectParentUniquePtr () | |
Creates a new empty QObjectParentUniquePtr. | |
QObjectParentUniquePtr (T *child, QObject *parent) | |
Takes a new QObjectParentUniquePtr and assign a child to it. | |
~QObjectParentUniquePtr () | |
Will delete the contained object if the parent still exists. | |
void | clear () |
Clears the pointer. | |
T * | data () const |
Returns the raw pointer to the managed QObject. | |
T * | get () const |
Returns the raw pointer to the managed child. | |
bool | isNull () const |
Checks if the managed pointer is nullptr . | |
operator bool () const | |
Checks if the pointer managed by this object is nullptr . | |
operator T* () const | |
Const getter for the managed raw pointer. | |
T & | operator* () const |
Dereferences the managed child. | |
T * | operator-> () const |
Returns a raw pointer to the managed child. | |
QObjectParentUniquePtr< T > & | operator= (T *child) |
Assigns a new child to the pointer. | |
T * | release () |
Clears the pointer and returns it. | |
void | reset (T *p=nullptr) |
Will reset the managed pointer to p. | |
void | setParentOwner (QObject *parent) |
Sets the parent object. | |
Keeps a pointer to an object owned by a QObject parent, and deletes it whenever this parent object is deleted.
It keeps a weak pointer to the QObject parent internally and the object pointer be set to nullptr
whenever the parent QObject is deleted.
Definition at line 270 of file qobjectuniqueptr.h.
|
inline |
Creates a new empty QObjectParentUniquePtr.
Definition at line 284 of file qobjectuniqueptr.h.
|
inline |
Takes a new QObjectParentUniquePtr and assign a child to it.
Definition at line 290 of file qobjectuniqueptr.h.
|
inline |
Will delete the contained object if the parent still exists.
Definition at line 303 of file qobjectuniqueptr.h.
|
inline |
Clears the pointer.
The managed object is set to nullptr
and will not be deleted.
Definition at line 416 of file qobjectuniqueptr.h.
|
inline |
Returns the raw pointer to the managed QObject.
Definition at line 355 of file qobjectuniqueptr.h.
|
inline |
Returns the raw pointer to the managed child.
Definition at line 363 of file qobjectuniqueptr.h.
|
inline |
Checks if the managed pointer is nullptr
.
Definition at line 397 of file qobjectuniqueptr.h.
|
inlineexplicit |
Checks if the pointer managed by this object is nullptr
.
If it is not nullptr
true
will be returned, if it is NULLPTR false
will be returned.
Definition at line 408 of file qobjectuniqueptr.h.
|
inline |
Const getter for the managed raw pointer.
Definition at line 389 of file qobjectuniqueptr.h.
|
inline |
Dereferences the managed child.
nullptr
if the parent has been deleted. Definition at line 381 of file qobjectuniqueptr.h.
|
inline |
Returns a raw pointer to the managed child.
Definition at line 371 of file qobjectuniqueptr.h.
|
inline |
Assigns a new child to the pointer.
The existing child will be deleted.
Definition at line 341 of file qobjectuniqueptr.h.
|
inline |
Clears the pointer and returns it.
The managed object will not be deleted and it is the callers responsibility to guarantee that no memory is leaked.
Definition at line 427 of file qobjectuniqueptr.h.
|
inline |
Will reset the managed pointer to p.
If there is already an object managed currently it will be deleted.
If p is not specified the managed object will be deleted and this object reset to nullptr
.
Definition at line 442 of file qobjectuniqueptr.h.
|
inline |
Sets the parent object.
Definition at line 321 of file qobjectuniqueptr.h.