QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
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 269 of file qobjectuniqueptr.h.
|
inline |
Creates a new empty QObjectParentUniquePtr.
Definition at line 283 of file qobjectuniqueptr.h.
|
inline |
Takes a new QObjectParentUniquePtr and assign a child to it.
Definition at line 289 of file qobjectuniqueptr.h.
|
inline |
Will delete the contained object if the parent still exists.
Definition at line 302 of file qobjectuniqueptr.h.
|
inline |
Clears the pointer.
The managed object is set to nullptr
and will not be deleted.
Definition at line 415 of file qobjectuniqueptr.h.
|
inline |
Returns the raw pointer to the managed QObject.
Definition at line 354 of file qobjectuniqueptr.h.
|
inline |
Returns the raw pointer to the managed child.
Definition at line 362 of file qobjectuniqueptr.h.
|
inline |
Checks if the managed pointer is nullptr
.
Definition at line 396 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 407 of file qobjectuniqueptr.h.
|
inline |
Const getter for the managed raw pointer.
Definition at line 388 of file qobjectuniqueptr.h.
|
inline |
Dereferences the managed child.
nullptr
if the parent has been deleted. Definition at line 380 of file qobjectuniqueptr.h.
|
inline |
Returns a raw pointer to the managed child.
Definition at line 370 of file qobjectuniqueptr.h.
|
inline |
Assigns a new child to the pointer.
The existing child will be deleted.
Definition at line 340 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 426 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 441 of file qobjectuniqueptr.h.
|
inline |
Sets the parent object.
Definition at line 320 of file qobjectuniqueptr.h.