|
QGIS API Documentation 3.99.0-Master (c22de0620c0)
|
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 290 of file qobjectuniqueptr.h.
|
inline |
Creates a new empty QObjectParentUniquePtr.
Definition at line 304 of file qobjectuniqueptr.h.
|
inline |
Takes a new QObjectParentUniquePtr and assign a child to it.
Definition at line 310 of file qobjectuniqueptr.h.
|
inline |
Will delete the contained object if the parent still exists.
Definition at line 323 of file qobjectuniqueptr.h.
|
inline |
Clears the pointer.
The managed object is set to nullptr and will not be deleted.
Definition at line 436 of file qobjectuniqueptr.h.
|
inline |
Returns the raw pointer to the managed QObject.
Definition at line 375 of file qobjectuniqueptr.h.
|
inline |
Returns the raw pointer to the managed child.
Definition at line 383 of file qobjectuniqueptr.h.
|
inline |
Checks if the managed pointer is nullptr.
Definition at line 417 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 428 of file qobjectuniqueptr.h.
|
inline |
Const getter for the managed raw pointer.
Definition at line 409 of file qobjectuniqueptr.h.
|
inline |
Dereferences the managed child.
nullptr if the parent has been deleted. Definition at line 401 of file qobjectuniqueptr.h.
|
inline |
Returns a raw pointer to the managed child.
Definition at line 391 of file qobjectuniqueptr.h.
|
inline |
Assigns a new child to the pointer.
The existing child will be deleted.
Definition at line 361 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 447 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 462 of file qobjectuniqueptr.h.
|
inline |
Sets the parent object.
Definition at line 341 of file qobjectuniqueptr.h.